Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Side by Side Diff: trunk/src/content/browser/gpu/gpu_pixel_browsertest.cc

Issue 22648006: Revert 216780 "Clean up compositor initialization/destruction." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/files/file_enumerator.h" 7 #include "base/files/file_enumerator.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "content/public/browser/render_view_host.h" 13 #include "content/public/browser/render_view_host.h"
14 #include "content/public/browser/render_widget_host_view.h" 14 #include "content/public/browser/render_widget_host_view.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "content/public/common/content_paths.h" 16 #include "content/public/common/content_paths.h"
17 #include "content/public/common/content_switches.h" 17 #include "content/public/common/content_switches.h"
18 #include "content/public/test/browser_test_utils.h" 18 #include "content/public/test/browser_test_utils.h"
19 #include "content/shell/shell.h" 19 #include "content/shell/shell.h"
20 #include "content/test/content_browser_test.h" 20 #include "content/test/content_browser_test.h"
21 #include "content/test/content_browser_test_utils.h" 21 #include "content/test/content_browser_test_utils.h"
22 #include "gpu/config/gpu_test_config.h" 22 #include "gpu/config/gpu_test_config.h"
23 #include "net/base/net_util.h" 23 #include "net/base/net_util.h"
24 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
25 #include "third_party/skia/include/core/SkBitmap.h" 25 #include "third_party/skia/include/core/SkBitmap.h"
26 #include "third_party/skia/include/core/SkColor.h" 26 #include "third_party/skia/include/core/SkColor.h"
27 #include "ui/compositor/compositor_setup.h"
27 #include "ui/gfx/codec/png_codec.h" 28 #include "ui/gfx/codec/png_codec.h"
28 #include "ui/gfx/size.h" 29 #include "ui/gfx/size.h"
29 #include "ui/gl/gl_switches.h" 30 #include "ui/gl/gl_switches.h"
30 #include "ui/snapshot/snapshot.h" 31 #include "ui/snapshot/snapshot.h"
31 32
32 namespace { 33 namespace {
33 34
34 enum ReferenceImageOption { 35 enum ReferenceImageOption {
35 kReferenceImageLocal, 36 kReferenceImageLocal,
36 kReferenceImageCheckedIn, 37 kReferenceImageCheckedIn,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // Test fixture for GPU image comparison tests. 99 // Test fixture for GPU image comparison tests.
99 // TODO(kkania): Document how to add to/modify these tests. 100 // TODO(kkania): Document how to add to/modify these tests.
100 class GpuPixelBrowserTest : public ContentBrowserTest { 101 class GpuPixelBrowserTest : public ContentBrowserTest {
101 public: 102 public:
102 GpuPixelBrowserTest() 103 GpuPixelBrowserTest()
103 : ref_img_revision_(0), 104 : ref_img_revision_(0),
104 ref_img_revision_no_older_than_(0), 105 ref_img_revision_no_older_than_(0),
105 ref_img_option_(kReferenceImageNone) { 106 ref_img_option_(kReferenceImageNone) {
106 } 107 }
107 108
108 virtual void SetUp() {
109 // We expect real pixel output for these tests.
110 UseRealGLContexts();
111
112 ContentBrowserTest::SetUp();
113 }
114
115 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 109 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
116 command_line->AppendSwitchASCII(switches::kTestGLLib, 110 command_line->AppendSwitchASCII(switches::kTestGLLib,
117 "libllvmpipe.so"); 111 "libllvmpipe.so");
118 } 112 }
119 113
120 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 114 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
121 ContentBrowserTest::SetUpInProcessBrowserTestFixture(); 115 ContentBrowserTest::SetUpInProcessBrowserTestFixture();
122 116
123 CommandLine* command_line = CommandLine::ForCurrentProcess(); 117 CommandLine* command_line = CommandLine::ForCurrentProcess();
124 if (command_line->HasSwitch(switches::kUseGpuInTests)) 118 if (command_line->HasSwitch(switches::kUseGpuInTests))
(...skipping 24 matching lines...) Expand all
149 break; 143 break;
150 } 144 }
151 145
152 test_name_ = testing::UnitTest::GetInstance()->current_test_info()->name(); 146 test_name_ = testing::UnitTest::GetInstance()->current_test_info()->name();
153 const char* test_status_prefixes[] = { 147 const char* test_status_prefixes[] = {
154 "DISABLED_", "FLAKY_", "FAILS_", "MANUAL_"}; 148 "DISABLED_", "FLAKY_", "FAILS_", "MANUAL_"};
155 for (size_t i = 0; i < arraysize(test_status_prefixes); ++i) { 149 for (size_t i = 0; i < arraysize(test_status_prefixes); ++i) {
156 ReplaceFirstSubstringAfterOffset( 150 ReplaceFirstSubstringAfterOffset(
157 &test_name_, 0, test_status_prefixes[i], std::string()); 151 &test_name_, 0, test_status_prefixes[i], std::string());
158 } 152 }
153
154 ui::DisableTestCompositor();
159 } 155 }
160 156
161 // If the existing ref image was saved from an revision older than the 157 // If the existing ref image was saved from an revision older than the
162 // ref_img_update_revision, refresh the ref image. 158 // ref_img_update_revision, refresh the ref image.
163 void RunPixelTest(const gfx::Size& tab_container_size, 159 void RunPixelTest(const gfx::Size& tab_container_size,
164 const base::FilePath& url, 160 const base::FilePath& url,
165 int64 ref_img_update_revision, 161 int64 ref_img_update_revision,
166 const ReferencePixel* ref_pixels, 162 const ReferencePixel* ref_pixels,
167 size_t ref_pixel_count) { 163 size_t ref_pixel_count) {
168 if (ref_img_option_ == kReferenceImageLocal) { 164 if (ref_img_option_ == kReferenceImageLocal) {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 555
560 gfx::Size container_size(400, 300); 556 gfx::Size container_size(400, 300);
561 base::FilePath url = 557 base::FilePath url =
562 test_data_dir().AppendASCII("pixel_browser_plugin.html"); 558 test_data_dir().AppendASCII("pixel_browser_plugin.html");
563 RunPixelTest(container_size, url, ref_img_revision_update, 559 RunPixelTest(container_size, url, ref_img_revision_update,
564 ref_pixels, ref_pixel_count); 560 ref_pixels, ref_pixel_count);
565 } 561 }
566 562
567 } // namespace content 563 } // namespace content
568 564
OLDNEW
« no previous file with comments | « trunk/src/content/browser/gpu/gpu_ipc_browsertests.cc ('k') | trunk/src/content/browser/media/media_browsertest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698