OLD | NEW |
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/message_loop/message_loop_proxy.h" | 6 #include "base/message_loop/message_loop_proxy.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/browser/gpu/compositor_util.h" | 9 #include "content/browser/gpu/compositor_util.h" |
10 #include "content/browser/gpu/gpu_data_manager_impl.h" | 10 #include "content/browser/gpu/gpu_data_manager_impl.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 // Common base class for browser tests. This is subclassed twice: Once to test | 67 // Common base class for browser tests. This is subclassed twice: Once to test |
68 // the browser in forced-compositing mode, and once to test with compositing | 68 // the browser in forced-compositing mode, and once to test with compositing |
69 // mode disabled. | 69 // mode disabled. |
70 class RenderWidgetHostViewBrowserTest : public ContentBrowserTest { | 70 class RenderWidgetHostViewBrowserTest : public ContentBrowserTest { |
71 public: | 71 public: |
72 RenderWidgetHostViewBrowserTest() | 72 RenderWidgetHostViewBrowserTest() |
73 : frame_size_(400, 300), | 73 : frame_size_(400, 300), |
74 callback_invoke_count_(0), | 74 callback_invoke_count_(0), |
75 frames_captured_(0) {} | 75 frames_captured_(0) {} |
76 | 76 |
77 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 77 virtual void SetUpOnMainThread() OVERRIDE { |
78 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &test_dir_)); | 78 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &test_dir_)); |
79 ContentBrowserTest::SetUpInProcessBrowserTestFixture(); | |
80 } | 79 } |
81 | 80 |
82 // Attempts to set up the source surface. Returns false if unsupported on the | 81 // Attempts to set up the source surface. Returns false if unsupported on the |
83 // current platform. | 82 // current platform. |
84 virtual bool SetUpSourceSurface(const char* wait_message) = 0; | 83 virtual bool SetUpSourceSurface(const char* wait_message) = 0; |
85 | 84 |
86 int callback_invoke_count() const { | 85 int callback_invoke_count() const { |
87 return callback_invoke_count_; | 86 return callback_invoke_count_; |
88 } | 87 } |
89 | 88 |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 output_size, | 867 output_size, |
869 expected_bitmap_size, | 868 expected_bitmap_size, |
870 video_frame); | 869 video_frame); |
871 } | 870 } |
872 | 871 |
873 class CompositingRenderWidgetHostViewTabCaptureHighDPI | 872 class CompositingRenderWidgetHostViewTabCaptureHighDPI |
874 : public CompositingRenderWidgetHostViewBrowserTestTabCapture { | 873 : public CompositingRenderWidgetHostViewBrowserTestTabCapture { |
875 public: | 874 public: |
876 CompositingRenderWidgetHostViewTabCaptureHighDPI() : kScale(2.f) {} | 875 CompositingRenderWidgetHostViewTabCaptureHighDPI() : kScale(2.f) {} |
877 | 876 |
878 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE { | 877 virtual void SetUpOnMainThread() OVERRIDE { |
879 CompositingRenderWidgetHostViewBrowserTestTabCapture::SetUpCommandLine(cmd); | 878 CommandLine* cmd = CommandLine::ForCurrentProcess(); |
880 cmd->AppendSwitchASCII(switches::kForceDeviceScaleFactor, | 879 cmd->AppendSwitchASCII(switches::kForceDeviceScaleFactor, |
881 base::StringPrintf("%f", scale())); | 880 base::StringPrintf("%f", scale())); |
882 #if defined(OS_WIN) | 881 #if defined(OS_WIN) |
883 gfx::ForceHighDPISupportForTesting(scale()); | 882 gfx::ForceHighDPISupportForTesting(scale()); |
884 gfx::EnableHighDPISupport(); | 883 gfx::EnableHighDPISupport(); |
885 #endif | 884 #endif |
886 } | 885 } |
887 | 886 |
888 float scale() const { return kScale; } | 887 float scale() const { return kScale; } |
889 | 888 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
947 CompositingRenderWidgetHostViewBrowserTestTabCapture, | 946 CompositingRenderWidgetHostViewBrowserTestTabCapture, |
948 testing::ValuesIn(kAllCompositingModes)); | 947 testing::ValuesIn(kAllCompositingModes)); |
949 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, | 948 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, |
950 CompositingRenderWidgetHostViewTabCaptureHighDPI, | 949 CompositingRenderWidgetHostViewTabCaptureHighDPI, |
951 testing::ValuesIn(kAllCompositingModes)); | 950 testing::ValuesIn(kAllCompositingModes)); |
952 | 951 |
953 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 952 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
954 | 953 |
955 } // namespace | 954 } // namespace |
956 } // namespace content | 955 } // namespace content |
OLD | NEW |