Index: components/test_runner/test_runner.cc |
diff --git a/components/test_runner/test_runner.cc b/components/test_runner/test_runner.cc |
index 0bfeefc35e998a86f48bc5eafcf8ef282adb4f9d..385863b270bb800b1d409d425711620008e9e621 100644 |
--- a/components/test_runner/test_runner.cc |
+++ b/components/test_runner/test_runner.cc |
@@ -1936,17 +1936,29 @@ const std::set<std::string>* TestRunner::httpHeadersToClear() const { |
return &http_headers_to_clear_; |
} |
-void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear) { |
- if (frame->top()->view() != main_view_) |
+bool TestRunner::isFramePartOfMainTestWindow(blink::WebFrame* frame) const { |
+ return test_is_running_ && frame->top()->view() == main_view_; |
+} |
+ |
+void TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { |
+ if (!isFramePartOfMainTestWindow(frame)) |
return; |
- if (!test_is_running_) |
+ |
+ if (top_loading_frame_) |
return; |
- if (clear) { |
- top_loading_frame_ = nullptr; |
- LocationChangeDone(); |
- } else if (!top_loading_frame_) { |
- top_loading_frame_ = frame; |
- } |
+ |
+ top_loading_frame_ = frame; |
+} |
+ |
+void TestRunner::tryToClearTopLoadingFrame(WebFrame* frame) { |
+ if (!isFramePartOfMainTestWindow(frame)) |
+ return; |
+ |
+ if (frame != top_loading_frame_) |
+ return; |
+ |
+ top_loading_frame_ = nullptr; |
+ LocationChangeDone(); |
} |
WebFrame* TestRunner::topLoadingFrame() const { |