Page Speed Optimization Libraries
1.4.26.1
|
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/rewriter/image_types.pb.h" 00027 #include "net/instaweb/util/public/basictypes.h" 00028 #include "net/instaweb/util/public/google_message_handler.h" 00029 #include "net/instaweb/util/public/gtest.h" 00030 #include "net/instaweb/util/public/mock_timer.h" 00031 #include "net/instaweb/util/public/scoped_ptr.h" 00032 #include "net/instaweb/util/public/stdio_file_system.h" 00033 #include "net/instaweb/util/public/string.h" 00034 00035 namespace net_instaweb { 00036 00037 class ImageTestBase : public testing::Test { 00038 protected: 00039 static const char kTestData[]; 00040 static const char kCuppa[]; 00041 static const char kCuppaTransparent[]; 00042 static const char kBikeCrash[]; 00043 static const char kIronChef[]; 00044 static const char kCradle[]; 00045 static const char kPuzzle[]; 00046 static const char kLarge[]; 00047 static const char kRedbrush[]; 00048 static const char kScenery[]; 00049 static const char kAppSegments[]; 00050 00051 typedef scoped_ptr<Image> ImagePtr; 00052 00053 ImageTestBase() : timer_(0), file_system_(&timer_) {} 00054 virtual ~ImageTestBase(); 00055 00058 Image* ImageFromString(ImageType output_type, 00059 const GoogleString& name, 00060 const GoogleString& contents, 00061 bool progressive); 00062 00065 Image* ReadFromFileWithOptions( 00066 const char* name, GoogleString* contents, 00067 Image::CompressionOptions* options); 00068 00071 Image* ReadImageFromFile(ImageType output_type, 00072 const char* filename, GoogleString* buffer, 00073 bool progressive); 00074 00075 MockTimer timer_; 00076 StdioFileSystem file_system_; 00077 GoogleMessageHandler handler_; 00078 00079 private: 00080 DISALLOW_COPY_AND_ASSIGN(ImageTestBase); 00081 }; 00082 00083 } 00084 00085 #endif ///< NET_INSTAWEB_REWRITER_PUBLIC_IMAGE_TEST_BASE_H_