OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/test_runner/test_runner.h" | 5 #include "content/shell/test_runner/test_runner.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 | 1793 |
1794 void TestRunner::DumpPixelsAsync( | 1794 void TestRunner::DumpPixelsAsync( |
1795 blink::WebView* web_view, | 1795 blink::WebView* web_view, |
1796 const base::Callback<void(const SkBitmap&)>& callback) { | 1796 const base::Callback<void(const SkBitmap&)>& callback) { |
1797 if (layout_test_runtime_flags_.dump_drag_image()) { | 1797 if (layout_test_runtime_flags_.dump_drag_image()) { |
1798 if (drag_image_.IsNull()) { | 1798 if (drag_image_.IsNull()) { |
1799 // This means the test called dumpDragImage but did not initiate a drag. | 1799 // This means the test called dumpDragImage but did not initiate a drag. |
1800 // Return a blank image so that the test fails. | 1800 // Return a blank image so that the test fails. |
1801 SkBitmap bitmap; | 1801 SkBitmap bitmap; |
1802 bitmap.allocN32Pixels(1, 1); | 1802 bitmap.allocN32Pixels(1, 1); |
1803 { | 1803 bitmap.eraseColor(0); |
1804 SkAutoLockPixels lock(bitmap); | |
1805 bitmap.eraseColor(0); | |
1806 } | |
1807 callback.Run(bitmap); | 1804 callback.Run(bitmap); |
1808 return; | 1805 return; |
1809 } | 1806 } |
1810 | 1807 |
1811 callback.Run(drag_image_.GetSkBitmap()); | 1808 callback.Run(drag_image_.GetSkBitmap()); |
1812 return; | 1809 return; |
1813 } | 1810 } |
1814 | 1811 |
1815 test_runner::DumpPixelsAsync(web_view, layout_test_runtime_flags_, | 1812 test_runner::DumpPixelsAsync(web_view, layout_test_runtime_flags_, |
1816 delegate_->GetDeviceScaleFactor(), callback); | 1813 delegate_->GetDeviceScaleFactor(), callback); |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2842 | 2839 |
2843 void TestRunner::NotifyDone() { | 2840 void TestRunner::NotifyDone() { |
2844 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2841 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
2845 !will_navigate_ && work_queue_.is_empty()) | 2842 !will_navigate_ && work_queue_.is_empty()) |
2846 delegate_->TestFinished(); | 2843 delegate_->TestFinished(); |
2847 layout_test_runtime_flags_.set_wait_until_done(false); | 2844 layout_test_runtime_flags_.set_wait_until_done(false); |
2848 OnLayoutTestRuntimeFlagsChanged(); | 2845 OnLayoutTestRuntimeFlagsChanged(); |
2849 } | 2846 } |
2850 | 2847 |
2851 } // namespace test_runner | 2848 } // namespace test_runner |
OLD | NEW |