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

Side by Side Diff: content/shell/renderer/layout_test/blink_test_runner.cc

Issue 2352813004: Force-generate a frame before the end of a layout test. (Closed)
Patch Set: none Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/shell/renderer/layout_test/blink_test_runner.h" 5 #include "content/shell/renderer/layout_test/blink_test_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <clocale> 10 #include <clocale>
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 return; 585 return;
586 } 586 }
587 test_runner::WebTestInterfaces* interfaces = 587 test_runner::WebTestInterfaces* interfaces =
588 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces(); 588 LayoutTestRenderThreadObserver::GetInstance()->test_interfaces();
589 interfaces->SetTestIsRunning(false); 589 interfaces->SetTestIsRunning(false);
590 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { 590 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) {
591 SyncNavigationStateVisitor visitor; 591 SyncNavigationStateVisitor visitor;
592 RenderView::ForEach(&visitor); 592 RenderView::ForEach(&visitor);
593 Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); 593 Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id()));
594 } else { 594 } else {
595 // clean out the lifecycle if needed before capturing the layout tree
596 // dump and pixels from the compositor.
597 render_view()->GetWebView()->mainFrame()->toWebLocalFrame()
598 ->frameWidget()->updateAllLifecyclePhases();
595 CaptureDump(); 599 CaptureDump();
596 } 600 }
597 } 601 }
598 602
599 void BlinkTestRunner::CloseRemainingWindows() { 603 void BlinkTestRunner::CloseRemainingWindows() {
600 Send(new ShellViewHostMsg_CloseRemainingWindows(routing_id())); 604 Send(new ShellViewHostMsg_CloseRemainingWindows(routing_id()));
601 } 605 }
602 606
603 void BlinkTestRunner::DeleteAllCookies() { 607 void BlinkTestRunner::DeleteAllCookies() {
604 Send(new LayoutTestHostMsg_DeleteAllCookies(routing_id())); 608 Send(new LayoutTestHostMsg_DeleteAllCookies(routing_id()));
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 interfaces->TestRunner()->ShouldGeneratePixelResults() && 873 interfaces->TestRunner()->ShouldGeneratePixelResults() &&
870 !interfaces->TestRunner()->ShouldDumpAsAudio()) { 874 !interfaces->TestRunner()->ShouldDumpAsAudio()) {
871 CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive()); 875 CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive());
872 interfaces->TestRunner()->DumpPixelsAsync( 876 interfaces->TestRunner()->DumpPixelsAsync(
873 render_view()->GetWebView(), 877 render_view()->GetWebView(),
874 base::Bind(&BlinkTestRunner::OnPixelsDumpCompleted, 878 base::Bind(&BlinkTestRunner::OnPixelsDumpCompleted,
875 base::Unretained(this))); 879 base::Unretained(this)));
876 return; 880 return;
877 } 881 }
878 882
879 #ifndef NDEBUG
880 // Force a layout/paint by the end of the test to ensure test coverage of
881 // incremental painting.
882 test_runner::LayoutAndPaintAsyncThen(
883 render_view()
884 ->GetWebView()
885 ->mainFrame()
886 ->toWebLocalFrame()
887 ->frameWidget(),
888 base::Bind(&BlinkTestRunner::CaptureDumpComplete,
889 base::Unretained(this)));
890 #else
891 CaptureDumpComplete(); 883 CaptureDumpComplete();
892 #endif
893 } 884 }
894 885
895 void BlinkTestRunner::OnPixelsDumpCompleted(const SkBitmap& snapshot) { 886 void BlinkTestRunner::OnPixelsDumpCompleted(const SkBitmap& snapshot) {
896 DCHECK_NE(0, snapshot.info().width()); 887 DCHECK_NE(0, snapshot.info().width());
897 DCHECK_NE(0, snapshot.info().height()); 888 DCHECK_NE(0, snapshot.info().height());
898 889
899 SkAutoLockPixels snapshot_lock(snapshot); 890 SkAutoLockPixels snapshot_lock(snapshot);
900 // The snapshot arrives from the GPU process via shared memory. Because MSan 891 // The snapshot arrives from the GPU process via shared memory. Because MSan
901 // can't track initializedness across processes, we must assure it that the 892 // can't track initializedness across processes, we must assure it that the
902 // pixels are in fact initialized. 893 // pixels are in fact initialized.
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 void BlinkTestRunner::ReportLeakDetectionResult( 1008 void BlinkTestRunner::ReportLeakDetectionResult(
1018 const LeakDetectionResult& report) { 1009 const LeakDetectionResult& report) {
1019 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 1010 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
1020 } 1011 }
1021 1012
1022 void BlinkTestRunner::OnDestruct() { 1013 void BlinkTestRunner::OnDestruct() {
1023 delete this; 1014 delete this;
1024 } 1015 }
1025 1016
1026 } // namespace content 1017 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698