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

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

Issue 22293003: Clean up compositor initialization/destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanupcompositor: UseRealGLBindings in NetInternalsTest 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"
28 #include "ui/gfx/codec/png_codec.h" 27 #include "ui/gfx/codec/png_codec.h"
29 #include "ui/gfx/size.h" 28 #include "ui/gfx/size.h"
30 #include "ui/gl/gl_switches.h" 29 #include "ui/gl/gl_switches.h"
31 #include "ui/snapshot/snapshot.h" 30 #include "ui/snapshot/snapshot.h"
32 31
33 namespace { 32 namespace {
34 33
35 enum ReferenceImageOption { 34 enum ReferenceImageOption {
36 kReferenceImageLocal, 35 kReferenceImageLocal,
37 kReferenceImageCheckedIn, 36 kReferenceImageCheckedIn,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Test fixture for GPU image comparison tests. 98 // Test fixture for GPU image comparison tests.
100 // TODO(kkania): Document how to add to/modify these tests. 99 // TODO(kkania): Document how to add to/modify these tests.
101 class GpuPixelBrowserTest : public ContentBrowserTest { 100 class GpuPixelBrowserTest : public ContentBrowserTest {
102 public: 101 public:
103 GpuPixelBrowserTest() 102 GpuPixelBrowserTest()
104 : ref_img_revision_(0), 103 : ref_img_revision_(0),
105 ref_img_revision_no_older_than_(0), 104 ref_img_revision_no_older_than_(0),
106 ref_img_option_(kReferenceImageNone) { 105 ref_img_option_(kReferenceImageNone) {
107 } 106 }
108 107
108 virtual void SetUp() {
109 // We expect real pixel output for these tests.
110 UseRealGLContexts();
111
112 ContentBrowserTest::SetUp();
113 }
114
109 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 115 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
110 command_line->AppendSwitchASCII(switches::kTestGLLib, 116 command_line->AppendSwitchASCII(switches::kTestGLLib,
111 "libllvmpipe.so"); 117 "libllvmpipe.so");
112 } 118 }
113 119
114 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 120 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
115 ContentBrowserTest::SetUpInProcessBrowserTestFixture(); 121 ContentBrowserTest::SetUpInProcessBrowserTestFixture();
116 122
117 CommandLine* command_line = CommandLine::ForCurrentProcess(); 123 CommandLine* command_line = CommandLine::ForCurrentProcess();
118 if (command_line->HasSwitch(switches::kUseGpuInTests)) 124 if (command_line->HasSwitch(switches::kUseGpuInTests))
(...skipping 24 matching lines...) Expand all
143 break; 149 break;
144 } 150 }
145 151
146 test_name_ = testing::UnitTest::GetInstance()->current_test_info()->name(); 152 test_name_ = testing::UnitTest::GetInstance()->current_test_info()->name();
147 const char* test_status_prefixes[] = { 153 const char* test_status_prefixes[] = {
148 "DISABLED_", "FLAKY_", "FAILS_", "MANUAL_"}; 154 "DISABLED_", "FLAKY_", "FAILS_", "MANUAL_"};
149 for (size_t i = 0; i < arraysize(test_status_prefixes); ++i) { 155 for (size_t i = 0; i < arraysize(test_status_prefixes); ++i) {
150 ReplaceFirstSubstringAfterOffset( 156 ReplaceFirstSubstringAfterOffset(
151 &test_name_, 0, test_status_prefixes[i], std::string()); 157 &test_name_, 0, test_status_prefixes[i], std::string());
152 } 158 }
153
154 ui::DisableTestCompositor();
155 } 159 }
156 160
157 // If the existing ref image was saved from an revision older than the 161 // If the existing ref image was saved from an revision older than the
158 // ref_img_update_revision, refresh the ref image. 162 // ref_img_update_revision, refresh the ref image.
159 void RunPixelTest(const gfx::Size& tab_container_size, 163 void RunPixelTest(const gfx::Size& tab_container_size,
160 const base::FilePath& url, 164 const base::FilePath& url,
161 int64 ref_img_update_revision, 165 int64 ref_img_update_revision,
162 const ReferencePixel* ref_pixels, 166 const ReferencePixel* ref_pixels,
163 size_t ref_pixel_count) { 167 size_t ref_pixel_count) {
164 if (ref_img_option_ == kReferenceImageLocal) { 168 if (ref_img_option_ == kReferenceImageLocal) {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 559
556 gfx::Size container_size(400, 300); 560 gfx::Size container_size(400, 300);
557 base::FilePath url = 561 base::FilePath url =
558 test_data_dir().AppendASCII("pixel_browser_plugin.html"); 562 test_data_dir().AppendASCII("pixel_browser_plugin.html");
559 RunPixelTest(container_size, url, ref_img_revision_update, 563 RunPixelTest(container_size, url, ref_img_revision_update,
560 ref_pixels, ref_pixel_count); 564 ref_pixels, ref_pixel_count);
561 } 565 }
562 566
563 } // namespace content 567 } // namespace content
564 568
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698