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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_browsertest.cc

Issue 21052007: aura: Clean up compositor initialization/destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanupcompositor: 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/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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // until at least one DeliverFrameCallback has been invoked. 397 // until at least one DeliverFrameCallback has been invoked.
399 IN_PROC_BROWSER_TEST_F(CompositingRenderWidgetHostViewBrowserTest, 398 IN_PROC_BROWSER_TEST_F(CompositingRenderWidgetHostViewBrowserTest,
400 FrameSubscriberTest) { 399 FrameSubscriberTest) {
401 SET_UP_SURFACE_OR_PASS_TEST(NULL); 400 SET_UP_SURFACE_OR_PASS_TEST(NULL);
402 RenderWidgetHostViewPort* const view = GetRenderWidgetHostViewPort(); 401 RenderWidgetHostViewPort* const view = GetRenderWidgetHostViewPort();
403 if (!view->CanSubscribeFrame()) { 402 if (!view->CanSubscribeFrame()) {
404 LOG(WARNING) << ("Blindly passing this test: Frame subscription not " 403 LOG(WARNING) << ("Blindly passing this test: Frame subscription not "
405 "supported on this platform."); 404 "supported on this platform.");
406 return; 405 return;
407 } 406 }
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 407
418 base::RunLoop run_loop; 408 base::RunLoop run_loop;
419 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber( 409 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber(
420 new FakeFrameSubscriber( 410 new FakeFrameSubscriber(
421 base::Bind(&RenderWidgetHostViewBrowserTest::FrameDelivered, 411 base::Bind(&RenderWidgetHostViewBrowserTest::FrameDelivered,
422 base::Unretained(this), 412 base::Unretained(this),
423 base::MessageLoopProxy::current(), 413 base::MessageLoopProxy::current(),
424 run_loop.QuitClosure()))); 414 run_loop.QuitClosure())));
425 view->BeginFrameSubscription(subscriber.Pass()); 415 view->BeginFrameSubscription(subscriber.Pass());
426 run_loop.Run(); 416 run_loop.Run();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 461
472 class CompositingRenderWidgetHostViewBrowserTestTabCapture 462 class CompositingRenderWidgetHostViewBrowserTestTabCapture
473 : public CompositingRenderWidgetHostViewBrowserTest { 463 : public CompositingRenderWidgetHostViewBrowserTest {
474 public: 464 public:
475 CompositingRenderWidgetHostViewBrowserTestTabCapture() 465 CompositingRenderWidgetHostViewBrowserTestTabCapture()
476 : expected_copy_from_compositing_surface_result_(false), 466 : expected_copy_from_compositing_surface_result_(false),
477 allowable_error_(0), 467 allowable_error_(0),
478 test_url_("data:text/html,<!doctype html>") {} 468 test_url_("data:text/html,<!doctype html>") {}
479 469
480 virtual void SetUp() OVERRIDE { 470 virtual void SetUp() OVERRIDE {
481 ui::DisableTestCompositor(); 471 // We expect real pixel output for these tests.
472 DoNotUseTestContexts();
473
482 CompositingRenderWidgetHostViewBrowserTest::SetUp(); 474 CompositingRenderWidgetHostViewBrowserTest::SetUp();
483 } 475 }
484 476
485 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 477 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
486 // TODO(Hubbe): This code is very similar to some code in 478 // TODO(Hubbe): This code is very similar to some code in
487 // gpu_feature_browsertest.cc, and should really be shared in a common 479 // gpu_feature_browsertest.cc, and should really be shared in a common
488 // location. 480 // location.
489 if (!command_line->HasSwitch(switches::kUseGpuInTests)) { 481 if (!command_line->HasSwitch(switches::kUseGpuInTests)) {
490 CHECK(!command_line->HasSwitch(switches::kUseGL)) 482 CHECK(!command_line->HasSwitch(switches::kUseGL))
491 << "kUseGL must not be set by test framework code!"; 483 << "kUseGL must not be set by test framework code!";
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 copy_rect, 893 copy_rect,
902 output_size, 894 output_size,
903 expected_bitmap_size, 895 expected_bitmap_size,
904 video_frame); 896 video_frame);
905 } 897 }
906 898
907 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 899 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
908 900
909 } // namespace 901 } // namespace
910 } // namespace content 902 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698