OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_TEST_RENDER_WIDGET_BROWSERTEST_H_ | |
6 #define CONTENT_TEST_RENDER_WIDGET_BROWSERTEST_H_ | |
7 #pragma once | |
8 | |
9 #include "base/basictypes.h" | |
10 #include "base/file_path.h" | |
11 #include "content/test/render_view_test.h" | |
12 | |
13 class SkBitmap; | |
14 | |
15 namespace gfx { | |
16 class Size; | |
17 } | |
18 | |
19 class RenderWidgetTest : public content::RenderViewTest { | |
20 public: | |
21 RenderWidgetTest(); | |
22 | |
23 protected: | |
24 static const int kNumBytesPerPixel; | |
25 static const int kLargeWidth; | |
26 static const int kLargeHeight; | |
27 static const int kSmallWidth; | |
28 static const int kSmallHeight; | |
29 static const int kTextPositionX; | |
30 static const int kTextPositionY; | |
31 static const uint32 kRedARGB; | |
32 | |
33 // Helper function which calls OnMsgPaintAtSize and also paints the result | |
34 // in the given bitmap. The widget is resized to |page_size| before we paint | |
35 // and the final image is resized to |desired_size|. This method is virtual so | |
36 // that TestResizeAndPaint() can be reused by subclasses of this test class. | |
37 virtual void ResizeAndPaint(const gfx::Size& page_size, | |
38 const gfx::Size& desired_size, | |
39 SkBitmap* snapshot); | |
40 | |
41 // Test for ResizeAndPaint. | |
42 void TestResizeAndPaint(); | |
43 | |
44 // Helper function which returns true if the given bitmap contains the given | |
45 // ARGB color and false otherwise. | |
46 bool ImageContainsColor(const SkBitmap& bitmap, uint32 argb_color); | |
47 | |
48 // This can be used for debugging if you want to output a bitmap | |
49 // image to a file. | |
50 // FilePath tmp_path; | |
51 // file_util::CreateTemporaryFile(&tmp_path); | |
52 // OutputBitmapToFile(bitmap, tmp_path); | |
53 // LOG(INFO) << "Bitmap image stored at: " << tmp_path.value(); | |
54 void OutputBitmapToFile(const SkBitmap& bitmap, const FilePath& file_path); | |
55 }; | |
56 | |
57 #endif // CONTENT_TEST_RENDER_WIDGET_BROWSERTEST_H_ | |
OLD | NEW |