| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/web_frame_test_client.h" | 5 #include "components/test_runner/web_frame_test_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 enum CheckDoneReason { | 183 enum CheckDoneReason { |
| 184 LoadFinished, | 184 LoadFinished, |
| 185 MainResourceLoadFailed, | 185 MainResourceLoadFailed, |
| 186 ResourceLoadCompleted | 186 ResourceLoadCompleted |
| 187 }; | 187 }; |
| 188 void CheckDone(blink::WebLocalFrame* frame, | 188 void CheckDone(blink::WebLocalFrame* frame, |
| 189 CheckDoneReason reason, | 189 CheckDoneReason reason, |
| 190 TestRunner* test_runner) { | 190 TestRunner* test_runner) { |
| 191 if (frame != test_runner->topLoadingFrame()) | |
| 192 return; | |
| 193 if (reason != MainResourceLoadFailed && | 191 if (reason != MainResourceLoadFailed && |
| 194 (frame->isResourceLoadInProgress() || frame->isLoading())) | 192 (frame->isResourceLoadInProgress() || frame->isLoading())) |
| 195 return; | 193 return; |
| 196 test_runner->setTopLoadingFrame(frame, true); | 194 test_runner->tryToClearTopLoadingFrame(frame); |
| 197 } | 195 } |
| 198 | 196 |
| 199 } // namespace | 197 } // namespace |
| 200 | 198 |
| 201 WebFrameTestClient::WebFrameTestClient( | 199 WebFrameTestClient::WebFrameTestClient( |
| 202 TestRunner* test_runner, | 200 TestRunner* test_runner, |
| 203 WebTestDelegate* delegate, | 201 WebTestDelegate* delegate, |
| 204 WebTestProxyBase* web_test_proxy_base) | 202 WebTestProxyBase* web_test_proxy_base) |
| 205 : test_runner_(test_runner), | 203 : test_runner_(test_runner), |
| 206 delegate_(delegate), | 204 delegate_(delegate), |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 } else { | 421 } else { |
| 424 delegate_->PrintMessage(std::string("Loading URL externally - \"") + | 422 delegate_->PrintMessage(std::string("Loading URL externally - \"") + |
| 425 URLDescription(request.url()) + "\"\n"); | 423 URLDescription(request.url()) + "\"\n"); |
| 426 } | 424 } |
| 427 delegate_->TestFinished(); | 425 delegate_->TestFinished(); |
| 428 } | 426 } |
| 429 } | 427 } |
| 430 | 428 |
| 431 void WebFrameTestClient::didStartProvisionalLoad(blink::WebLocalFrame* frame, | 429 void WebFrameTestClient::didStartProvisionalLoad(blink::WebLocalFrame* frame, |
| 432 double trigering_event_time) { | 430 double trigering_event_time) { |
| 433 if (!test_runner_->topLoadingFrame()) | 431 test_runner_->tryToSetTopLoadingFrame(frame); |
| 434 test_runner_->setTopLoadingFrame(frame, false); | |
| 435 | 432 |
| 436 if (test_runner_->shouldDumpFrameLoadCallbacks()) { | 433 if (test_runner_->shouldDumpFrameLoadCallbacks()) { |
| 437 PrintFrameDescription(delegate_, frame); | 434 PrintFrameDescription(delegate_, frame); |
| 438 delegate_->PrintMessage(" - didStartProvisionalLoadForFrame\n"); | 435 delegate_->PrintMessage(" - didStartProvisionalLoadForFrame\n"); |
| 439 } | 436 } |
| 440 | 437 |
| 441 if (test_runner_->shouldDumpUserGestureInFrameLoadCallbacks()) { | 438 if (test_runner_->shouldDumpUserGestureInFrameLoadCallbacks()) { |
| 442 PrintFrameuserGestureStatus(delegate_, frame, | 439 PrintFrameuserGestureStatus(delegate_, frame, |
| 443 " - in didStartProvisionalLoadForFrame\n"); | 440 " - in didStartProvisionalLoadForFrame\n"); |
| 444 } | 441 } |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 else | 766 else |
| 770 callback->onError(blink::WebSetSinkIdError::NotFound); | 767 callback->onError(blink::WebSetSinkIdError::NotFound); |
| 771 } | 768 } |
| 772 | 769 |
| 773 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { | 770 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { |
| 774 web_test_proxy_base_->test_interfaces()->BindTo(frame); | 771 web_test_proxy_base_->test_interfaces()->BindTo(frame); |
| 775 web_test_proxy_base_->BindTo(frame); | 772 web_test_proxy_base_->BindTo(frame); |
| 776 } | 773 } |
| 777 | 774 |
| 778 } // namespace test_runner | 775 } // namespace test_runner |
| OLD | NEW |