Page Speed Optimization Libraries  1.2.24.1
net/instaweb/rewriter/public/image_test_base.h
Go to the documentation of this file.
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 "net/instaweb/util/public/basictypes.h"
00023 #include "net/instaweb/util/public/google_message_handler.h"
00024 #include "net/instaweb/util/public/gtest.h"
00025 #include "net/instaweb/util/public/mock_timer.h"
00026 #include "net/instaweb/util/public/scoped_ptr.h"
00027 #include "net/instaweb/util/public/stdio_file_system.h"
00028 #include "net/instaweb/util/public/string.h"
00029 
00030 namespace net_instaweb {
00031 
00032 class ImageTestBase : public testing::Test {
00033  protected:
00034   static const char kTestData[];
00035   static const char kCuppa[];
00036   static const char kBikeCrash[];
00037   static const char kIronChef[];
00038   static const char kCradle[];
00039   static const char kPuzzle[];
00040   static const char kLarge[];
00041   static const char kScenery[];
00042   static const char kAppSegments[];
00043 
00044   typedef scoped_ptr<Image> ImagePtr;
00045 
00046   ImageTestBase() : timer_(0), file_system_(&timer_) {}
00047   virtual ~ImageTestBase();
00048 
00051   Image* ImageFromString(Image::Type output_type,
00052                          const GoogleString& name,
00053                          const GoogleString& contents,
00054                          bool progressive);
00055 
00058   Image* ReadFromFileWithOptions(
00059       const char* name, GoogleString* contents,
00060       Image::CompressionOptions* options);
00061 
00064   Image* ReadImageFromFile(Image::Type output_type,
00065                            const char* filename, GoogleString* buffer,
00066                            bool progressive);
00067 
00068   MockTimer timer_;
00069   StdioFileSystem file_system_;
00070   GoogleMessageHandler handler_;
00071 
00072  private:
00073   DISALLOW_COPY_AND_ASSIGN(ImageTestBase);
00074 };
00075 
00076 }  
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines