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 "components/test_runner/test_runner.h" | 5 #include "components/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 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 return; | 1825 return; |
1826 } | 1826 } |
1827 | 1827 |
1828 test_runner::DumpPixelsAsync(web_view, layout_test_runtime_flags_, | 1828 test_runner::DumpPixelsAsync(web_view, layout_test_runtime_flags_, |
1829 delegate_->GetDeviceScaleFactorForTest(), | 1829 delegate_->GetDeviceScaleFactorForTest(), |
1830 callback); | 1830 callback); |
1831 } | 1831 } |
1832 | 1832 |
1833 void TestRunner::ReplicateLayoutTestRuntimeFlagsChanges( | 1833 void TestRunner::ReplicateLayoutTestRuntimeFlagsChanges( |
1834 const base::DictionaryValue& changed_values) { | 1834 const base::DictionaryValue& changed_values) { |
1835 DCHECK(test_is_running_); | 1835 if (test_is_running_) |
1836 layout_test_runtime_flags_.tracked_dictionary().ApplyUntrackedChanges( | 1836 layout_test_runtime_flags_.tracked_dictionary().ApplyUntrackedChanges( |
1837 changed_values); | 1837 changed_values); |
1838 } | 1838 } |
1839 | 1839 |
1840 bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const { | 1840 bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const { |
1841 if (shouldDumpAsCustomText()) { | 1841 if (shouldDumpAsCustomText()) { |
1842 *custom_text_dump = customDumpText(); | 1842 *custom_text_dump = customDumpText(); |
1843 return true; | 1843 return true; |
1844 } | 1844 } |
1845 | 1845 |
1846 return false; | 1846 return false; |
1847 } | 1847 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1937 } | 1937 } |
1938 | 1938 |
1939 bool TestRunner::isFramePartOfMainTestWindow(blink::WebFrame* frame) const { | 1939 bool TestRunner::isFramePartOfMainTestWindow(blink::WebFrame* frame) const { |
1940 return test_is_running_ && frame->top()->view() == main_view_; | 1940 return test_is_running_ && frame->top()->view() == main_view_; |
1941 } | 1941 } |
1942 | 1942 |
1943 void TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { | 1943 void TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { |
1944 if (!isFramePartOfMainTestWindow(frame)) | 1944 if (!isFramePartOfMainTestWindow(frame)) |
1945 return; | 1945 return; |
1946 | 1946 |
1947 if (top_loading_frame_) | 1947 if (top_loading_frame_ || layout_test_runtime_flags_.have_top_loading_frame()) |
1948 return; | 1948 return; |
1949 | 1949 |
1950 top_loading_frame_ = frame; | 1950 top_loading_frame_ = frame; |
| 1951 layout_test_runtime_flags_.set_have_top_loading_frame(true); |
| 1952 OnLayoutTestRuntimeFlagsChanged(); |
1951 } | 1953 } |
1952 | 1954 |
1953 void TestRunner::tryToClearTopLoadingFrame(WebFrame* frame) { | 1955 void TestRunner::tryToClearTopLoadingFrame(WebFrame* frame) { |
1954 if (!isFramePartOfMainTestWindow(frame)) | 1956 if (!isFramePartOfMainTestWindow(frame)) |
1955 return; | 1957 return; |
1956 | 1958 |
1957 if (frame != top_loading_frame_) | 1959 if (frame != top_loading_frame_) |
1958 return; | 1960 return; |
1959 | 1961 |
1960 top_loading_frame_ = nullptr; | 1962 top_loading_frame_ = nullptr; |
| 1963 DCHECK(layout_test_runtime_flags_.have_top_loading_frame()); |
| 1964 layout_test_runtime_flags_.set_have_top_loading_frame(false); |
| 1965 OnLayoutTestRuntimeFlagsChanged(); |
| 1966 |
1961 LocationChangeDone(); | 1967 LocationChangeDone(); |
1962 } | 1968 } |
1963 | 1969 |
1964 WebFrame* TestRunner::topLoadingFrame() const { | 1970 WebFrame* TestRunner::topLoadingFrame() const { |
1965 return top_loading_frame_; | 1971 return top_loading_frame_; |
1966 } | 1972 } |
1967 | 1973 |
1968 void TestRunner::policyDelegateDone() { | 1974 void TestRunner::policyDelegateDone() { |
1969 DCHECK(layout_test_runtime_flags_.wait_until_done()); | 1975 DCHECK(layout_test_runtime_flags_.wait_until_done()); |
1970 delegate_->TestFinished(); | 1976 delegate_->TestFinished(); |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3118 | 3124 |
3119 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( | 3125 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( |
3120 web_view(), base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, | 3126 web_view(), base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, |
3121 weak_factory_.GetWeakPtr(), | 3127 weak_factory_.GetWeakPtr(), |
3122 base::Passed(std::move(persistent_callback)))); | 3128 base::Passed(std::move(persistent_callback)))); |
3123 } | 3129 } |
3124 | 3130 |
3125 void TestRunner::OnLayoutTestRuntimeFlagsChanged() { | 3131 void TestRunner::OnLayoutTestRuntimeFlagsChanged() { |
3126 if (layout_test_runtime_flags_.tracked_dictionary().changed_values().empty()) | 3132 if (layout_test_runtime_flags_.tracked_dictionary().changed_values().empty()) |
3127 return; | 3133 return; |
| 3134 if (!test_is_running_) |
| 3135 return; |
3128 | 3136 |
3129 delegate_->OnLayoutTestRuntimeFlagsChanged( | 3137 delegate_->OnLayoutTestRuntimeFlagsChanged( |
3130 layout_test_runtime_flags_.tracked_dictionary().changed_values()); | 3138 layout_test_runtime_flags_.tracked_dictionary().changed_values()); |
3131 layout_test_runtime_flags_.tracked_dictionary().ResetChangeTracking(); | 3139 layout_test_runtime_flags_.tracked_dictionary().ResetChangeTracking(); |
3132 } | 3140 } |
3133 | 3141 |
3134 void TestRunnerForSpecificView::ForceNextWebGLContextCreationToFail() { | 3142 void TestRunnerForSpecificView::ForceNextWebGLContextCreationToFail() { |
3135 web_view()->forceNextWebGLContextCreationToFail(); | 3143 web_view()->forceNextWebGLContextCreationToFail(); |
3136 } | 3144 } |
3137 | 3145 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3354 | 3362 |
3355 blink::WebView* TestRunnerForSpecificView::web_view() { | 3363 blink::WebView* TestRunnerForSpecificView::web_view() { |
3356 return web_test_proxy_base_->web_view(); | 3364 return web_test_proxy_base_->web_view(); |
3357 } | 3365 } |
3358 | 3366 |
3359 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 3367 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
3360 return web_test_proxy_base_->delegate(); | 3368 return web_test_proxy_base_->delegate(); |
3361 } | 3369 } |
3362 | 3370 |
3363 } // namespace test_runner | 3371 } // namespace test_runner |
OLD | NEW |