Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 | 580 |
| 581 void BlinkTestRunner::TestFinished() { | 581 void BlinkTestRunner::TestFinished() { |
| 582 if (!is_main_window_ || !render_view()->GetMainRenderFrame()) { | 582 if (!is_main_window_ || !render_view()->GetMainRenderFrame()) { |
| 583 RenderThread::Get()->Send( | 583 RenderThread::Get()->Send( |
| 584 new LayoutTestHostMsg_TestFinishedInSecondaryRenderer()); | 584 new LayoutTestHostMsg_TestFinishedInSecondaryRenderer()); |
| 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 interfaces->TestRunner()->RunPendingAnimations(); | |
| 590 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { | 591 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { |
| 591 SyncNavigationStateVisitor visitor; | 592 SyncNavigationStateVisitor visitor; |
| 592 RenderView::ForEach(&visitor); | 593 RenderView::ForEach(&visitor); |
| 593 Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); | 594 Send(new ShellViewHostMsg_CaptureSessionHistory(routing_id())); |
| 594 } else { | 595 } else { |
| 595 CaptureDump(); | 596 CaptureDump(); |
| 596 } | 597 } |
| 597 } | 598 } |
| 598 | 599 |
| 599 void BlinkTestRunner::CloseRemainingWindows() { | 600 void BlinkTestRunner::CloseRemainingWindows() { |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 869 interfaces->TestRunner()->ShouldGeneratePixelResults() && | 870 interfaces->TestRunner()->ShouldGeneratePixelResults() && |
| 870 !interfaces->TestRunner()->ShouldDumpAsAudio()) { | 871 !interfaces->TestRunner()->ShouldDumpAsAudio()) { |
| 871 CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive()); | 872 CHECK(render_view()->GetWebView()->isAcceleratedCompositingActive()); |
| 872 interfaces->TestRunner()->DumpPixelsAsync( | 873 interfaces->TestRunner()->DumpPixelsAsync( |
| 873 render_view()->GetWebView(), | 874 render_view()->GetWebView(), |
| 874 base::Bind(&BlinkTestRunner::OnPixelsDumpCompleted, | 875 base::Bind(&BlinkTestRunner::OnPixelsDumpCompleted, |
| 875 base::Unretained(this))); | 876 base::Unretained(this))); |
| 876 return; | 877 return; |
| 877 } | 878 } |
| 878 | 879 |
| 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( | |
|
chrishtr
2016/09/19 23:49:38
@wangxianzhu: this is no longer needed, right?
Xianzhu
2016/09/20 02:40:35
Right. This had been needed before sync painting.
| |
| 883 render_view() | |
| 884 ->GetWebView() | |
| 885 ->mainFrame() | |
| 886 ->toWebLocalFrame() | |
| 887 ->frameWidget(), | |
| 888 base::Bind(&BlinkTestRunner::CaptureDumpComplete, | |
| 889 base::Unretained(this))); | |
| 890 #else | |
| 891 CaptureDumpComplete(); | 880 CaptureDumpComplete(); |
| 892 #endif | |
| 893 } | 881 } |
| 894 | 882 |
| 895 void BlinkTestRunner::OnPixelsDumpCompleted(const SkBitmap& snapshot) { | 883 void BlinkTestRunner::OnPixelsDumpCompleted(const SkBitmap& snapshot) { |
| 896 DCHECK_NE(0, snapshot.info().width()); | 884 DCHECK_NE(0, snapshot.info().width()); |
| 897 DCHECK_NE(0, snapshot.info().height()); | 885 DCHECK_NE(0, snapshot.info().height()); |
| 898 | 886 |
| 899 SkAutoLockPixels snapshot_lock(snapshot); | 887 SkAutoLockPixels snapshot_lock(snapshot); |
| 900 // The snapshot arrives from the GPU process via shared memory. Because MSan | 888 // 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 | 889 // can't track initializedness across processes, we must assure it that the |
| 902 // pixels are in fact initialized. | 890 // pixels are in fact initialized. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 void BlinkTestRunner::ReportLeakDetectionResult( | 1005 void BlinkTestRunner::ReportLeakDetectionResult( |
| 1018 const LeakDetectionResult& report) { | 1006 const LeakDetectionResult& report) { |
| 1019 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); | 1007 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); |
| 1020 } | 1008 } |
| 1021 | 1009 |
| 1022 void BlinkTestRunner::OnDestruct() { | 1010 void BlinkTestRunner::OnDestruct() { |
| 1023 delete this; | 1011 delete this; |
| 1024 } | 1012 } |
| 1025 | 1013 |
| 1026 } // namespace content | 1014 } // namespace content |
| OLD | NEW |