Page Speed Optimization Libraries  1.9.32.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
image_test_base.h
Go to the documentation of this file.
1 
2 /*
3  * Copyright 2010 Google Inc.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http:///www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
18 
20 
21 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_IMAGE_TEST_BASE_H_
22 #define NET_INSTAWEB_REWRITER_PUBLIC_IMAGE_TEST_BASE_H_
23 
25 
26 #include "net/instaweb/rewriter/image_types.pb.h"
30 #include "net/instaweb/util/public/mock_timer.h"
31 #include "net/instaweb/util/public/null_mutex.h"
35 
36 namespace net_instaweb {
37 
38 class ImageTestBase : public testing::Test {
39  protected:
40  static const char kTestData[];
41  static const char kAppSegments[];
42  static const char kBikeCrash[];
43  static const char kCradle[];
44  static const char kCuppa[];
45  static const char kCuppaTransparent[];
46  static const char kIronChef[];
47  static const char kLarge[];
48  static const char kPuzzle[];
49  static const char kRedbrush[];
50  static const char kScenery[];
51  static const char kTransparent[];
52 
53  typedef scoped_ptr<Image> ImagePtr;
54 
55  ImageTestBase() :
56  timer_(new NullMutex, 0),
57  message_handler_(new NullMutex) {
58  }
59 
60  virtual ~ImageTestBase();
61 
64  Image* ImageFromString(ImageType output_type,
65  const GoogleString& name,
66  const GoogleString& contents,
67  bool progressive);
68 
72  const char* name, GoogleString* contents,
73  Image::CompressionOptions* options);
74 
77  Image* ReadImageFromFile(ImageType output_type,
78  const char* filename, GoogleString* buffer,
79  bool progressive);
80 
81  MockTimer timer_;
82  StdioFileSystem file_system_;
83  MockMessageHandler message_handler_;
84 
85  private:
86  DISALLOW_COPY_AND_ASSIGN(ImageTestBase);
87 };
88 
89 }
90 
91 #endif
Definition: image_test_base.h:38
Image * ImageFromString(ImageType output_type, const GoogleString &name, const GoogleString &contents, bool progressive)
Image * ReadFromFileWithOptions(const char *name, GoogleString *contents, Image::CompressionOptions *options)
Definition: image.h:38
Image * ReadImageFromFile(ImageType output_type, const char *filename, GoogleString *buffer, bool progressive)