Chromium Code Reviews| 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/gpu_data_manager_impl.h" | 9 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| 10 #include "content/browser/renderer_host/dip_util.h" | 10 #include "content/browser/renderer_host/dip_util.h" |
| 11 #include "content/browser/renderer_host/render_widget_host_impl.h" | 11 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 12 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" | 12 #include "content/port/browser/render_widget_host_view_frame_subscriber.h" |
| 13 #include "content/port/browser/render_widget_host_view_port.h" | 13 #include "content/port/browser/render_widget_host_view_port.h" |
| 14 #include "content/public/browser/compositor_util.h" | 14 #include "content/public/browser/compositor_util.h" |
| 15 #include "content/public/browser/render_view_host.h" | 15 #include "content/public/browser/render_view_host.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/content_paths.h" | 17 #include "content/public/common/content_paths.h" |
| 18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 19 #include "content/public/test/browser_test_utils.h" | 19 #include "content/public/test/browser_test_utils.h" |
| 20 #include "content/shell/shell.h" | 20 #include "content/shell/shell.h" |
| 21 #include "content/test/content_browser_test.h" | 21 #include "content/test/content_browser_test.h" |
| 22 #include "content/test/content_browser_test_utils.h" | 22 #include "content/test/content_browser_test_utils.h" |
| 23 #include "media/base/video_frame.h" | 23 #include "media/base/video_frame.h" |
| 24 #include "media/filters/skcanvas_video_renderer.h" | 24 #include "media/filters/skcanvas_video_renderer.h" |
| 25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 26 #include "third_party/skia/include/core/SkBitmap.h" | 26 #include "third_party/skia/include/core/SkBitmap.h" |
| 27 #include "third_party/skia/include/core/SkCanvas.h" | 27 #include "third_party/skia/include/core/SkCanvas.h" |
| 28 #include "third_party/skia/include/core/SkDevice.h" | 28 #include "third_party/skia/include/core/SkDevice.h" |
| 29 #include "ui/base/ui_base_switches.h" | 29 #include "ui/base/ui_base_switches.h" |
| 30 #include "ui/compositor/compositor_setup.h" | |
| 31 #include "ui/gfx/size_conversions.h" | 30 #include "ui/gfx/size_conversions.h" |
| 32 #include "ui/gl/gl_switches.h" | 31 #include "ui/gl/gl_switches.h" |
| 33 | 32 |
| 34 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
| 35 #include "ui/gl/io_surface_support_mac.h" | 34 #include "ui/gl/io_surface_support_mac.h" |
| 36 #endif | 35 #endif |
| 37 | 36 |
| 38 #if defined(OS_WIN) | 37 #if defined(OS_WIN) |
| 39 #include "ui/base/win/dpi.h" | 38 #include "ui/base/win/dpi.h" |
| 40 #endif | 39 #endif |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 private: | 203 private: |
| 205 const gfx::Size frame_size_; | 204 const gfx::Size frame_size_; |
| 206 base::FilePath test_dir_; | 205 base::FilePath test_dir_; |
| 207 int callback_invoke_count_; | 206 int callback_invoke_count_; |
| 208 int frames_captured_; | 207 int frames_captured_; |
| 209 }; | 208 }; |
| 210 | 209 |
| 211 class CompositingRenderWidgetHostViewBrowserTest | 210 class CompositingRenderWidgetHostViewBrowserTest |
| 212 : public RenderWidgetHostViewBrowserTest { | 211 : public RenderWidgetHostViewBrowserTest { |
| 213 public: | 212 public: |
| 213 virtual void SetUp() OVERRIDE { | |
| 214 // We expect real pixel output for these tests. | |
| 215 DoNotUseTestContexts(); | |
|
danakj
2013/07/31 20:14:50
This change makes these tests actually run instead
| |
| 216 | |
| 217 RenderWidgetHostViewBrowserTest::SetUp(); | |
| 218 } | |
| 219 | |
| 214 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 220 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 215 // Note: Not appending kForceCompositingMode switch here, since not all bots | 221 // Note: Not appending kForceCompositingMode switch here, since not all bots |
| 216 // support compositing. Some bots will run with compositing on, and others | 222 // support compositing. Some bots will run with compositing on, and others |
| 217 // won't. Therefore, the call to SetUpSourceSurface() later on will detect | 223 // won't. Therefore, the call to SetUpSourceSurface() later on will detect |
| 218 // whether compositing mode is actually on or not. If not, the tests will | 224 // whether compositing mode is actually on or not. If not, the tests will |
| 219 // pass blindly, logging a warning message, since we cannot test what the | 225 // pass blindly, logging a warning message, since we cannot test what the |
| 220 // platform/implementation does not support. | 226 // platform/implementation does not support. |
| 221 RenderWidgetHostViewBrowserTest::SetUpCommandLine(command_line); | 227 RenderWidgetHostViewBrowserTest::SetUpCommandLine(command_line); |
| 222 } | 228 } |
| 223 | 229 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 // until at least one DeliverFrameCallback has been invoked. | 404 // until at least one DeliverFrameCallback has been invoked. |
| 399 IN_PROC_BROWSER_TEST_F(CompositingRenderWidgetHostViewBrowserTest, | 405 IN_PROC_BROWSER_TEST_F(CompositingRenderWidgetHostViewBrowserTest, |
| 400 FrameSubscriberTest) { | 406 FrameSubscriberTest) { |
| 401 SET_UP_SURFACE_OR_PASS_TEST(NULL); | 407 SET_UP_SURFACE_OR_PASS_TEST(NULL); |
| 402 RenderWidgetHostViewPort* const view = GetRenderWidgetHostViewPort(); | 408 RenderWidgetHostViewPort* const view = GetRenderWidgetHostViewPort(); |
| 403 if (!view->CanSubscribeFrame()) { | 409 if (!view->CanSubscribeFrame()) { |
| 404 LOG(WARNING) << ("Blindly passing this test: Frame subscription not " | 410 LOG(WARNING) << ("Blindly passing this test: Frame subscription not " |
| 405 "supported on this platform."); | 411 "supported on this platform."); |
| 406 return; | 412 return; |
| 407 } | 413 } |
| 408 #if defined(USE_AURA) | |
| 409 if (ui::IsTestCompositorEnabled()) { | |
| 410 LOG(WARNING) << ("Blindly passing this test: Aura test compositor doesn't " | |
| 411 "support frame subscription."); | |
| 412 // TODO(miu): Aura test compositor should support frame subscription for | |
| 413 // testing. http://crbug.com/240572 | |
| 414 return; | |
| 415 } | |
| 416 #endif | |
| 417 | 414 |
| 418 base::RunLoop run_loop; | 415 base::RunLoop run_loop; |
| 419 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber( | 416 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber( |
| 420 new FakeFrameSubscriber( | 417 new FakeFrameSubscriber( |
| 421 base::Bind(&RenderWidgetHostViewBrowserTest::FrameDelivered, | 418 base::Bind(&RenderWidgetHostViewBrowserTest::FrameDelivered, |
| 422 base::Unretained(this), | 419 base::Unretained(this), |
| 423 base::MessageLoopProxy::current(), | 420 base::MessageLoopProxy::current(), |
| 424 run_loop.QuitClosure()))); | 421 run_loop.QuitClosure()))); |
| 425 view->BeginFrameSubscription(subscriber.Pass()); | 422 view->BeginFrameSubscription(subscriber.Pass()); |
| 426 run_loop.Run(); | 423 run_loop.Run(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 | 468 |
| 472 class CompositingRenderWidgetHostViewBrowserTestTabCapture | 469 class CompositingRenderWidgetHostViewBrowserTestTabCapture |
| 473 : public CompositingRenderWidgetHostViewBrowserTest { | 470 : public CompositingRenderWidgetHostViewBrowserTest { |
| 474 public: | 471 public: |
| 475 CompositingRenderWidgetHostViewBrowserTestTabCapture() | 472 CompositingRenderWidgetHostViewBrowserTestTabCapture() |
| 476 : expected_copy_from_compositing_surface_result_(false), | 473 : expected_copy_from_compositing_surface_result_(false), |
| 477 allowable_error_(0), | 474 allowable_error_(0), |
| 478 test_url_("data:text/html,<!doctype html>") {} | 475 test_url_("data:text/html,<!doctype html>") {} |
| 479 | 476 |
| 480 virtual void SetUp() OVERRIDE { | 477 virtual void SetUp() OVERRIDE { |
| 481 ui::DisableTestCompositor(); | 478 // We expect real pixel output for these tests. |
| 479 DoNotUseTestContexts(); | |
| 480 | |
| 482 CompositingRenderWidgetHostViewBrowserTest::SetUp(); | 481 CompositingRenderWidgetHostViewBrowserTest::SetUp(); |
| 483 } | 482 } |
| 484 | 483 |
| 485 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 484 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 486 // TODO(Hubbe): This code is very similar to some code in | 485 // TODO(Hubbe): This code is very similar to some code in |
| 487 // gpu_feature_browsertest.cc, and should really be shared in a common | 486 // gpu_feature_browsertest.cc, and should really be shared in a common |
| 488 // location. | 487 // location. |
| 489 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { | 488 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { |
| 490 CHECK(!command_line->HasSwitch(switches::kUseGL)) | 489 CHECK(!command_line->HasSwitch(switches::kUseGL)) |
| 491 << "kUseGL must not be set by test framework code!"; | 490 << "kUseGL must not be set by test framework code!"; |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 copy_rect, | 900 copy_rect, |
| 902 output_size, | 901 output_size, |
| 903 expected_bitmap_size, | 902 expected_bitmap_size, |
| 904 video_frame); | 903 video_frame); |
| 905 } | 904 } |
| 906 | 905 |
| 907 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 906 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 908 | 907 |
| 909 } // namespace | 908 } // namespace |
| 910 } // namespace content | 909 } // namespace content |
| OLD | NEW |