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

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

Issue 238933009: Remove --disable-accelerated-compositing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 WaitForCopySourceReady(); 270 WaitForCopySourceReady();
271 return true; 271 return true;
272 } 272 }
273 273
274 private: 274 private:
275 const CompositingMode compositing_mode_; 275 const CompositingMode compositing_mode_;
276 276
277 DISALLOW_COPY_AND_ASSIGN(CompositingRenderWidgetHostViewBrowserTest); 277 DISALLOW_COPY_AND_ASSIGN(CompositingRenderWidgetHostViewBrowserTest);
278 }; 278 };
279 279
280 class NonCompositingRenderWidgetHostViewBrowserTest
281 : public RenderWidgetHostViewBrowserTest {
282 public:
283 NonCompositingRenderWidgetHostViewBrowserTest() {}
284
285 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
286 // Note: Appending the kDisableAcceleratedCompositing switch here, but there
287 // are some builds that only use compositing and will ignore this switch.
288 // Therefore, the call to SetUpSourceSurface() later on will detect whether
289 // compositing mode is actually off. If it's on, the tests will pass
290 // blindly, logging a warning message, since we cannot test what the
291 // platform/implementation does not support.
292 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing);
293 RenderWidgetHostViewBrowserTest::SetUpCommandLine(command_line);
294 }
295
296 virtual GURL TestUrl() {
297 return GURL(kAboutBlankURL);
298 }
299
300 virtual bool SetUpSourceSurface(const char* wait_message) OVERRIDE {
301 if (IsForceCompositingModeEnabled())
302 return false; // See comment in SetUpCommandLine().
303
304 content::DOMMessageQueue message_queue;
305 NavigateToURL(shell(), TestUrl());
306 if (wait_message != NULL) {
307 std::string result(wait_message);
308 if (!message_queue.WaitForMessage(&result)) {
309 EXPECT_TRUE(false) << "WaitForMessage " << result << " failed.";
310 return false;
311 }
312 }
313
314 WaitForCopySourceReady();
315 // Return whether the renderer left accelerated compositing turned off.
316 return !GetRenderWidgetHost()->is_accelerated_compositing_active();
317 }
318
319 private:
320 DISALLOW_COPY_AND_ASSIGN(NonCompositingRenderWidgetHostViewBrowserTest);
321 };
322
323 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber { 280 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber {
324 public: 281 public:
325 FakeFrameSubscriber( 282 FakeFrameSubscriber(
326 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback) 283 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback)
327 : callback_(callback) { 284 : callback_(callback) {
328 } 285 }
329 286
330 virtual bool ShouldCaptureFrame(base::TimeTicks present_time, 287 virtual bool ShouldCaptureFrame(base::TimeTicks present_time,
331 scoped_refptr<media::VideoFrame>* storage, 288 scoped_refptr<media::VideoFrame>* storage,
332 DeliverFrameCallback* callback) OVERRIDE { 289 DeliverFrameCallback* callback) OVERRIDE {
(...skipping 18 matching lines...) Expand all
351 // implementation. 308 // implementation.
352 #if !defined(OS_ANDROID) && !defined(OS_IOS) 309 #if !defined(OS_ANDROID) && !defined(OS_IOS)
353 310
354 // The CopyFromBackingStore() API should work on all platforms when compositing 311 // The CopyFromBackingStore() API should work on all platforms when compositing
355 // is enabled. 312 // is enabled.
356 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, 313 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest,
357 CopyFromBackingStore) { 314 CopyFromBackingStore) {
358 RunBasicCopyFromBackingStoreTest(); 315 RunBasicCopyFromBackingStoreTest();
359 } 316 }
360 317
361 // The CopyFromBackingStore() API should work on all platforms when compositing
362 // is disabled.
363 IN_PROC_BROWSER_TEST_F(NonCompositingRenderWidgetHostViewBrowserTest,
364 CopyFromBackingStore) {
365 RunBasicCopyFromBackingStoreTest();
366 }
367
368 // Tests that the callback passed to CopyFromBackingStore is always called, 318 // Tests that the callback passed to CopyFromBackingStore is always called,
369 // even when the RenderWidgetHost is deleting in the middle of an async copy. 319 // even when the RenderWidgetHost is deleting in the middle of an async copy.
370 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, 320 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest,
371 CopyFromBackingStore_CallbackDespiteDelete) { 321 CopyFromBackingStore_CallbackDespiteDelete) {
372 SET_UP_SURFACE_OR_PASS_TEST(NULL); 322 SET_UP_SURFACE_OR_PASS_TEST(NULL);
373 323
374 base::RunLoop run_loop; 324 base::RunLoop run_loop;
375 GetRenderViewHost()->CopyFromBackingStore( 325 GetRenderViewHost()->CopyFromBackingStore(
376 gfx::Rect(), 326 gfx::Rect(),
377 frame_size(), 327 frame_size(),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 gfx::Rect(view->GetViewBounds().size()), dest, base::Bind( 366 gfx::Rect(view->GetViewBounds().size()), dest, base::Bind(
417 &RenderWidgetHostViewBrowserTest::FinishCopyFromCompositingSurface, 367 &RenderWidgetHostViewBrowserTest::FinishCopyFromCompositingSurface,
418 base::Unretained(this), run_loop.QuitClosure())); 368 base::Unretained(this), run_loop.QuitClosure()));
419 // Delete the surface before the callback is run. 369 // Delete the surface before the callback is run.
420 view->AcceleratedSurfaceRelease(); 370 view->AcceleratedSurfaceRelease();
421 run_loop.Run(); 371 run_loop.Run();
422 372
423 EXPECT_EQ(1, callback_invoke_count()); 373 EXPECT_EQ(1, callback_invoke_count());
424 } 374 }
425 375
426 // With compositing turned off, no platforms should support the
427 // CopyFromCompositingSurfaceToVideoFrame() API.
428 IN_PROC_BROWSER_TEST_F(NonCompositingRenderWidgetHostViewBrowserTest,
429 CopyFromCompositingSurfaceToVideoFrameCallbackTest) {
430 SET_UP_SURFACE_OR_PASS_TEST(NULL);
431 EXPECT_FALSE(GetRenderWidgetHostViewPort()->CanCopyToVideoFrame());
432 }
433
434 // Test basic frame subscription functionality. We subscribe, and then run 376 // Test basic frame subscription functionality. We subscribe, and then run
435 // until at least one DeliverFrameCallback has been invoked. 377 // until at least one DeliverFrameCallback has been invoked.
436 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, 378 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest,
437 FrameSubscriberTest) { 379 FrameSubscriberTest) {
438 SET_UP_SURFACE_OR_PASS_TEST(NULL); 380 SET_UP_SURFACE_OR_PASS_TEST(NULL);
439 RenderWidgetHostViewPort* const view = GetRenderWidgetHostViewPort(); 381 RenderWidgetHostViewPort* const view = GetRenderWidgetHostViewPort();
440 if (!view->CanSubscribeFrame()) { 382 if (!view->CanSubscribeFrame()) {
441 LOG(WARNING) << ("Blindly passing this test: Frame subscription not " 383 LOG(WARNING) << ("Blindly passing this test: Frame subscription not "
442 "supported on this platform."); 384 "supported on this platform.");
443 return; 385 return;
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 CompositingRenderWidgetHostViewBrowserTestTabCapture, 888 CompositingRenderWidgetHostViewBrowserTestTabCapture,
947 testing::ValuesIn(kAllCompositingModes)); 889 testing::ValuesIn(kAllCompositingModes));
948 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, 890 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing,
949 CompositingRenderWidgetHostViewTabCaptureHighDPI, 891 CompositingRenderWidgetHostViewTabCaptureHighDPI,
950 testing::ValuesIn(kAllCompositingModes)); 892 testing::ValuesIn(kAllCompositingModes));
951 893
952 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 894 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
953 895
954 } // namespace 896 } // namespace
955 } // namespace content 897 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698