Page Speed Optimization Libraries  1.3.25.1
net/instaweb/rewriter/public/image_test_base.h
Go to the documentation of this file.
00001 
00002 /*
00003  * Copyright 2010 Google Inc.
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *      http:///www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00018 
00020 
00021 #ifndef NET_INSTAWEB_REWRITER_PUBLIC_IMAGE_TEST_BASE_H_
00022 #define NET_INSTAWEB_REWRITER_PUBLIC_IMAGE_TEST_BASE_H_
00023 
00024 #include "net/instaweb/rewriter/public/image.h"
00025 
00026 #include "net/instaweb/util/public/basictypes.h"
00027 #include "net/instaweb/util/public/google_message_handler.h"
00028 #include "net/instaweb/util/public/gtest.h"
00029 #include "net/instaweb/util/public/mock_timer.h"
00030 #include "net/instaweb/util/public/scoped_ptr.h"
00031 #include "net/instaweb/util/public/stdio_file_system.h"
00032 #include "net/instaweb/util/public/string.h"
00033 
00034 namespace net_instaweb {
00035 
00036 class ImageTestBase : public testing::Test {
00037  protected:
00038   static const char kTestData[];
00039   static const char kCuppa[];
00040   static const char kCuppaTransparent[];
00041   static const char kBikeCrash[];
00042   static const char kIronChef[];
00043   static const char kCradle[];
00044   static const char kPuzzle[];
00045   static const char kLarge[];
00046   static const char kRedbrush[];
00047   static const char kScenery[];
00048   static const char kAppSegments[];
00049 
00050   typedef scoped_ptr<Image> ImagePtr;
00051 
00052   ImageTestBase() : timer_(0), file_system_(&timer_) {}
00053   virtual ~ImageTestBase();
00054 
00057   Image* ImageFromString(Image::Type output_type,
00058                          const GoogleString& name,
00059                          const GoogleString& contents,
00060                          bool progressive);
00061 
00064   Image* ReadFromFileWithOptions(
00065       const char* name, GoogleString* contents,
00066       Image::CompressionOptions* options);
00067 
00070   Image* ReadImageFromFile(Image::Type output_type,
00071                            const char* filename, GoogleString* buffer,
00072                            bool progressive);
00073 
00074   MockTimer timer_;
00075   StdioFileSystem file_system_;
00076   GoogleMessageHandler handler_;
00077 
00078  private:
00079   DISALLOW_COPY_AND_ASSIGN(ImageTestBase);
00080 };
00081 
00082 }  
00083 
00084 #endif  ///< NET_INSTAWEB_REWRITER_PUBLIC_IMAGE_TEST_BASE_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines