Commit c71bb6f5 authored by arthursonzogni's avatar arthursonzogni Committed by Commit Bot

Cleanup web_test test_runner slightly.

* Make tryToSetTopLevelFrame() and tryToClearTopLevelFrame() to return
void instead. Nobody was using the returned value anyway.
* Remove topLoadingFrame(). I was not used externally.

No behavior changes here.

Bug: 936696
Change-Id: I21c4266140dba897a89f4ae558c2a30dbb44615b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1492339
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarŁukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarNasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638607}
parent 787570a2
......@@ -1446,7 +1446,7 @@ TestRunner::WorkQueue::~WorkQueue() {
}
void TestRunner::WorkQueue::ProcessWorkSoon() {
if (controller_->topLoadingFrame())
if (controller_->top_loading_frame_)
return;
if (!queue_.empty()) {
......@@ -1488,7 +1488,7 @@ void TestRunner::WorkQueue::ProcessWork() {
}
if (!controller_->web_test_runtime_flags_.wait_until_done() &&
!controller_->topLoadingFrame())
!controller_->top_loading_frame_)
controller_->delegate_->TestFinished();
}
......@@ -1833,25 +1833,24 @@ bool TestRunner::IsFramePartOfMainTestWindow(blink::WebFrame* frame) const {
return test_is_running_ && frame->Top()->View() == main_view_;
}
bool TestRunner::tryToSetTopLoadingFrame(blink::WebFrame* frame) {
void TestRunner::tryToSetTopLoadingFrame(blink::WebFrame* frame) {
if (!IsFramePartOfMainTestWindow(frame))
return false;
return;
if (top_loading_frame_ || web_test_runtime_flags_.have_top_loading_frame())
return false;
return;
top_loading_frame_ = frame;
web_test_runtime_flags_.set_have_top_loading_frame(true);
OnWebTestRuntimeFlagsChanged();
return true;
}
bool TestRunner::tryToClearTopLoadingFrame(blink::WebFrame* frame) {
void TestRunner::tryToClearTopLoadingFrame(blink::WebFrame* frame) {
if (!IsFramePartOfMainTestWindow(frame))
return false;
return;
if (frame != top_loading_frame_)
return false;
return;
top_loading_frame_ = nullptr;
DCHECK(web_test_runtime_flags_.have_top_loading_frame());
......@@ -1859,11 +1858,6 @@ bool TestRunner::tryToClearTopLoadingFrame(blink::WebFrame* frame) {
OnWebTestRuntimeFlagsChanged();
LocationChangeDone();
return true;
}
blink::WebFrame* TestRunner::topLoadingFrame() const {
return top_loading_frame_;
}
blink::WebFrame* TestRunner::mainFrame() const {
......@@ -2599,7 +2593,7 @@ void TestRunner::CheckResponseMimeType() {
}
void TestRunner::NotifyDone() {
if (web_test_runtime_flags_.wait_until_done() && !topLoadingFrame() &&
if (web_test_runtime_flags_.wait_until_done() && !top_loading_frame_ &&
work_queue_.is_empty())
delegate_->TestFinished();
web_test_runtime_flags_.set_wait_until_done(false);
......
......@@ -136,20 +136,19 @@ class TestRunner : public WebTestRunner {
bool animation_requires_raster() const { return animation_requires_raster_; }
void SetAnimationRequiresRaster(bool do_raster);
// To be called when |frame| starts loading - TestRunner will check if
// there is currently no top-loading-frame being tracked and if so, then it
// will return true and start tracking |frame| as the top-loading-frame.
bool tryToSetTopLoadingFrame(blink::WebFrame* frame);
// To be called when |frame| starts loading - TestRunner will check if there
// is currently no top-loading-frame being tracked and if so, then it will
// start tracking |frame| as the top-loading-frame.
void tryToSetTopLoadingFrame(blink::WebFrame* frame);
// To be called when |frame| finishes loading - TestRunner will check if
// |frame| is currently tracked as the top-loading-frame, and if yes, then it
// will return true, stop top-loading-frame tracking, and potentially finish
// the test (unless testRunner.waitUntilDone() was called and/or there are
// pending load requests in WorkQueue).
bool tryToClearTopLoadingFrame(blink::WebFrame*);
// |frame| is currently tracked as the top-loading-frame, if yes, stop
// top-loading-frame tracking, and potentially finish the test (unless
// testRunner.waitUntilDone() was called and/or there are pending load
// requests in WorkQueue).
void tryToClearTopLoadingFrame(blink::WebFrame*);
blink::WebFrame* mainFrame() const;
blink::WebFrame* topLoadingFrame() const;
void policyDelegateDone();
bool policyDelegateEnabled() const;
bool policyDelegateIsPermissive() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment