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 bool TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { | 1943 bool TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { |
1944 if (!IsFramePartOfMainTestWindow(frame)) | 1944 if (!IsFramePartOfMainTestWindow(frame)) |
1945 return false; | 1945 return false; |
1946 | 1946 |
1947 if (top_loading_frame_) | 1947 if (top_loading_frame_ || layout_test_runtime_flags_.have_top_loading_frame()) |
1948 return false; | 1948 return false; |
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 return true; | 1953 return true; |
1952 } | 1954 } |
1953 | 1955 |
1954 bool TestRunner::tryToClearTopLoadingFrame(WebFrame* frame) { | 1956 bool TestRunner::tryToClearTopLoadingFrame(WebFrame* frame) { |
1955 if (!IsFramePartOfMainTestWindow(frame)) | 1957 if (!IsFramePartOfMainTestWindow(frame)) |
1956 return false; | 1958 return false; |
1957 | 1959 |
1958 if (frame != top_loading_frame_) | 1960 if (frame != top_loading_frame_) |
1959 return false; | 1961 return false; |
1960 | 1962 |
1961 top_loading_frame_ = nullptr; | 1963 top_loading_frame_ = nullptr; |
| 1964 DCHECK(layout_test_runtime_flags_.have_top_loading_frame()); |
| 1965 layout_test_runtime_flags_.set_have_top_loading_frame(false); |
| 1966 OnLayoutTestRuntimeFlagsChanged(); |
| 1967 |
1962 LocationChangeDone(); | 1968 LocationChangeDone(); |
1963 return true; | 1969 return true; |
1964 } | 1970 } |
1965 | 1971 |
1966 WebFrame* TestRunner::topLoadingFrame() const { | 1972 WebFrame* TestRunner::topLoadingFrame() const { |
1967 return top_loading_frame_; | 1973 return top_loading_frame_; |
1968 } | 1974 } |
1969 | 1975 |
1970 void TestRunner::policyDelegateDone() { | 1976 void TestRunner::policyDelegateDone() { |
1971 DCHECK(layout_test_runtime_flags_.wait_until_done()); | 1977 DCHECK(layout_test_runtime_flags_.wait_until_done()); |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3120 | 3126 |
3121 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( | 3127 web_test_proxy_base_->test_interfaces()->GetTestRunner()->DumpPixelsAsync( |
3122 web_view(), base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, | 3128 web_view(), base::Bind(&TestRunnerForSpecificView::CapturePixelsCallback, |
3123 weak_factory_.GetWeakPtr(), | 3129 weak_factory_.GetWeakPtr(), |
3124 base::Passed(std::move(persistent_callback)))); | 3130 base::Passed(std::move(persistent_callback)))); |
3125 } | 3131 } |
3126 | 3132 |
3127 void TestRunner::OnLayoutTestRuntimeFlagsChanged() { | 3133 void TestRunner::OnLayoutTestRuntimeFlagsChanged() { |
3128 if (layout_test_runtime_flags_.tracked_dictionary().changed_values().empty()) | 3134 if (layout_test_runtime_flags_.tracked_dictionary().changed_values().empty()) |
3129 return; | 3135 return; |
| 3136 if (!test_is_running_) |
| 3137 return; |
3130 | 3138 |
3131 delegate_->OnLayoutTestRuntimeFlagsChanged( | 3139 delegate_->OnLayoutTestRuntimeFlagsChanged( |
3132 layout_test_runtime_flags_.tracked_dictionary().changed_values()); | 3140 layout_test_runtime_flags_.tracked_dictionary().changed_values()); |
3133 layout_test_runtime_flags_.tracked_dictionary().ResetChangeTracking(); | 3141 layout_test_runtime_flags_.tracked_dictionary().ResetChangeTracking(); |
3134 } | 3142 } |
3135 | 3143 |
3136 void TestRunnerForSpecificView::ForceNextWebGLContextCreationToFail() { | 3144 void TestRunnerForSpecificView::ForceNextWebGLContextCreationToFail() { |
3137 web_view()->forceNextWebGLContextCreationToFail(); | 3145 web_view()->forceNextWebGLContextCreationToFail(); |
3138 } | 3146 } |
3139 | 3147 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3356 | 3364 |
3357 blink::WebView* TestRunnerForSpecificView::web_view() { | 3365 blink::WebView* TestRunnerForSpecificView::web_view() { |
3358 return web_test_proxy_base_->web_view(); | 3366 return web_test_proxy_base_->web_view(); |
3359 } | 3367 } |
3360 | 3368 |
3361 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 3369 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
3362 return web_test_proxy_base_->delegate(); | 3370 return web_test_proxy_base_->delegate(); |
3363 } | 3371 } |
3364 | 3372 |
3365 } // namespace test_runner | 3373 } // namespace test_runner |
OLD | NEW |