Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Unified Diff: components/test_runner/test_runner.cc

Issue 1893783002: Split TestRunner::setTopLoadingFrame into separate "set" and "clear" methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replicate-across-all-renderers
Patch Set: Rebasing... Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_frame_test_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b668843775086dfa8b2c64a0961c1fa6a073ae89 100644
--- a/components/test_runner/test_runner.cc
+++ b/components/test_runner/test_runner.cc
@@ -1936,17 +1936,31 @@ 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_)
- return;
- if (!test_is_running_)
- return;
- if (clear) {
- top_loading_frame_ = nullptr;
- LocationChangeDone();
- } else if (!top_loading_frame_) {
- top_loading_frame_ = frame;
- }
+bool TestRunner::IsFramePartOfMainTestWindow(blink::WebFrame* frame) const {
+ return test_is_running_ && frame->top()->view() == main_view_;
+}
+
+bool TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) {
+ if (!IsFramePartOfMainTestWindow(frame))
+ return false;
+
+ if (top_loading_frame_)
+ return false;
+
+ top_loading_frame_ = frame;
+ return true;
+}
+
+bool TestRunner::tryToClearTopLoadingFrame(WebFrame* frame) {
+ if (!IsFramePartOfMainTestWindow(frame))
+ return false;
+
+ if (frame != top_loading_frame_)
+ return false;
+
+ top_loading_frame_ = nullptr;
+ LocationChangeDone();
+ return true;
}
WebFrame* TestRunner::topLoadingFrame() const {
« no previous file with comments | « components/test_runner/test_runner.h ('k') | components/test_runner/web_frame_test_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698