Chromium Code Reviews| 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 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1548 TestRunner::TestRunner(TestInterfaces* interfaces) | 1548 TestRunner::TestRunner(TestInterfaces* interfaces) |
| 1549 : test_is_running_(false), | 1549 : test_is_running_(false), |
| 1550 close_remaining_windows_(false), | 1550 close_remaining_windows_(false), |
| 1551 work_queue_(this), | 1551 work_queue_(this), |
| 1552 web_history_item_count_(0), | 1552 web_history_item_count_(0), |
| 1553 test_interfaces_(interfaces), | 1553 test_interfaces_(interfaces), |
| 1554 delegate_(nullptr), | 1554 delegate_(nullptr), |
| 1555 main_view_(nullptr), | 1555 main_view_(nullptr), |
| 1556 mock_content_settings_client_( | 1556 mock_content_settings_client_( |
| 1557 new MockContentSettingsClient(&layout_test_runtime_flags_)), | 1557 new MockContentSettingsClient(&layout_test_runtime_flags_)), |
| 1558 is_navigating_(false), | |
| 1558 credential_manager_client_(new MockCredentialManagerClient), | 1559 credential_manager_client_(new MockCredentialManagerClient), |
| 1559 mock_screen_orientation_client_(new MockScreenOrientationClient), | 1560 mock_screen_orientation_client_(new MockScreenOrientationClient), |
| 1560 spellcheck_(new SpellCheckClient(this)), | 1561 spellcheck_(new SpellCheckClient(this)), |
| 1561 chooser_count_(0), | 1562 chooser_count_(0), |
| 1562 previously_focused_view_(nullptr), | 1563 previously_focused_view_(nullptr), |
| 1563 is_web_platform_tests_mode_(false), | 1564 is_web_platform_tests_mode_(false), |
| 1564 weak_factory_(this) {} | 1565 weak_factory_(this) {} |
| 1565 | 1566 |
| 1566 TestRunner::~TestRunner() {} | 1567 TestRunner::~TestRunner() {} |
| 1567 | 1568 |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1579 if (speech_recognizer_) | 1580 if (speech_recognizer_) |
| 1580 speech_recognizer_->SetDelegate(delegate); | 1581 speech_recognizer_->SetDelegate(delegate); |
| 1581 } | 1582 } |
| 1582 | 1583 |
| 1583 void TestRunner::SetMainView(WebView* web_view) { | 1584 void TestRunner::SetMainView(WebView* web_view) { |
| 1584 main_view_ = web_view; | 1585 main_view_ = web_view; |
| 1585 } | 1586 } |
| 1586 | 1587 |
| 1587 void TestRunner::Reset() { | 1588 void TestRunner::Reset() { |
| 1588 is_web_platform_tests_mode_ = false; | 1589 is_web_platform_tests_mode_ = false; |
| 1590 is_navigating_ = false; | |
| 1589 top_loading_frame_ = nullptr; | 1591 top_loading_frame_ = nullptr; |
| 1590 layout_test_runtime_flags_.Reset(); | 1592 layout_test_runtime_flags_.Reset(); |
| 1591 mock_screen_orientation_client_->ResetData(); | 1593 mock_screen_orientation_client_->ResetData(); |
| 1592 drag_image_.reset(); | 1594 drag_image_.reset(); |
| 1593 widgets_with_scheduled_animations_.clear(); | 1595 widgets_with_scheduled_animations_.clear(); |
| 1594 | 1596 |
| 1595 WebSecurityPolicy::resetOriginAccessWhitelists(); | 1597 WebSecurityPolicy::resetOriginAccessWhitelists(); |
| 1596 #if defined(__linux__) || defined(ANDROID) | 1598 #if defined(__linux__) || defined(ANDROID) |
| 1597 WebFontRendering::setSubpixelPositioning(false); | 1599 WebFontRendering::setSubpixelPositioning(false); |
| 1598 #endif | 1600 #endif |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1830 | 1832 |
| 1831 const std::set<std::string>* TestRunner::httpHeadersToClear() const { | 1833 const std::set<std::string>* TestRunner::httpHeadersToClear() const { |
| 1832 return &http_headers_to_clear_; | 1834 return &http_headers_to_clear_; |
| 1833 } | 1835 } |
| 1834 | 1836 |
| 1835 bool TestRunner::IsFramePartOfMainTestWindow(blink::WebFrame* frame) const { | 1837 bool TestRunner::IsFramePartOfMainTestWindow(blink::WebFrame* frame) const { |
| 1836 return test_is_running_ && frame->top()->view() == main_view_; | 1838 return test_is_running_ && frame->top()->view() == main_view_; |
| 1837 } | 1839 } |
| 1838 | 1840 |
| 1839 bool TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { | 1841 bool TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { |
| 1842 is_navigating_ = false; | |
|
clamy
2016/07/19 13:50:34
Can it be possible for the new frame to be navigat
blundell
2016/07/21 10:02:18
Yes. The flow is this:
- FrameLoader::startLoad()
| |
| 1840 if (!IsFramePartOfMainTestWindow(frame)) | 1843 if (!IsFramePartOfMainTestWindow(frame)) |
| 1841 return false; | 1844 return false; |
| 1842 | 1845 |
| 1843 if (top_loading_frame_ || layout_test_runtime_flags_.have_top_loading_frame()) | 1846 if (top_loading_frame_ || layout_test_runtime_flags_.have_top_loading_frame()) |
| 1844 return false; | 1847 return false; |
| 1845 | 1848 |
| 1846 top_loading_frame_ = frame; | 1849 top_loading_frame_ = frame; |
| 1847 layout_test_runtime_flags_.set_have_top_loading_frame(true); | 1850 layout_test_runtime_flags_.set_have_top_loading_frame(true); |
| 1848 OnLayoutTestRuntimeFlagsChanged(); | 1851 OnLayoutTestRuntimeFlagsChanged(); |
| 1849 return true; | 1852 return true; |
| 1850 } | 1853 } |
| 1851 | 1854 |
| 1852 bool TestRunner::tryToClearTopLoadingFrame(WebFrame* frame) { | 1855 bool TestRunner::tryToClearTopLoadingFrame(WebFrame* frame) { |
| 1856 is_navigating_ = false; | |
| 1853 if (!IsFramePartOfMainTestWindow(frame)) | 1857 if (!IsFramePartOfMainTestWindow(frame)) |
| 1854 return false; | 1858 return false; |
| 1855 | 1859 |
| 1856 if (frame != top_loading_frame_) | 1860 if (frame != top_loading_frame_) |
| 1857 return false; | 1861 return false; |
| 1858 | 1862 |
| 1859 top_loading_frame_ = nullptr; | 1863 top_loading_frame_ = nullptr; |
| 1860 DCHECK(layout_test_runtime_flags_.have_top_loading_frame()); | 1864 DCHECK(layout_test_runtime_flags_.have_top_loading_frame()); |
| 1861 layout_test_runtime_flags_.set_have_top_loading_frame(false); | 1865 layout_test_runtime_flags_.set_have_top_loading_frame(false); |
| 1862 OnLayoutTestRuntimeFlagsChanged(); | 1866 OnLayoutTestRuntimeFlagsChanged(); |
| (...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2728 if (mimeType != "text/plain") | 2732 if (mimeType != "text/plain") |
| 2729 return; | 2733 return; |
| 2730 | 2734 |
| 2731 layout_test_runtime_flags_.set_dump_as_text(true); | 2735 layout_test_runtime_flags_.set_dump_as_text(true); |
| 2732 layout_test_runtime_flags_.set_generate_pixel_results(false); | 2736 layout_test_runtime_flags_.set_generate_pixel_results(false); |
| 2733 OnLayoutTestRuntimeFlagsChanged(); | 2737 OnLayoutTestRuntimeFlagsChanged(); |
| 2734 } | 2738 } |
| 2735 | 2739 |
| 2736 void TestRunner::NotifyDone() { | 2740 void TestRunner::NotifyDone() { |
| 2737 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2741 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
| 2738 work_queue_.is_empty()) | 2742 !is_navigating_ && work_queue_.is_empty()) { |
| 2739 delegate_->TestFinished(); | 2743 delegate_->TestFinished(); |
| 2744 } | |
| 2740 layout_test_runtime_flags_.set_wait_until_done(false); | 2745 layout_test_runtime_flags_.set_wait_until_done(false); |
| 2741 OnLayoutTestRuntimeFlagsChanged(); | 2746 OnLayoutTestRuntimeFlagsChanged(); |
| 2742 } | 2747 } |
| 2743 | 2748 |
| 2744 } // namespace test_runner | 2749 } // namespace test_runner |
| OLD | NEW |