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