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

Unified Diff: content/shell/test_runner/test_runner.cc

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 years, 6 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 | « content/shell/test_runner/pixel_dump.cc ('k') | content/shell/test_runner/test_runner_for_specific_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/test_runner/test_runner.cc
diff --git a/content/shell/test_runner/test_runner.cc b/content/shell/test_runner/test_runner.cc
index 9763472d529cb9c09848472b1dbf58f8eb30f32e..14d491551be07ca9fdb9698101bb609b93b11e11 100644
--- a/content/shell/test_runner/test_runner.cc
+++ b/content/shell/test_runner/test_runner.cc
@@ -5,6 +5,8 @@
#include "content/shell/test_runner/test_runner.h"
#include <stddef.h>
+
+#include <algorithm>
#include <limits>
#include <utility>
@@ -1999,7 +2001,7 @@ void TestRunner::ShowDevTools(const std::string& settings,
class WorkItemBackForward : public TestRunner::WorkItem {
public:
- WorkItemBackForward(int distance) : distance_(distance) {}
+ explicit WorkItemBackForward(int distance) : distance_(distance) {}
bool Run(WebTestDelegate* delegate, WebView*) override {
delegate->GoToOffset(distance_);
@@ -2037,7 +2039,7 @@ void TestRunner::QueueReload() {
class WorkItemLoadingScript : public TestRunner::WorkItem {
public:
- WorkItemLoadingScript(const std::string& script) : script_(script) {}
+ explicit WorkItemLoadingScript(const std::string& script) : script_(script) {}
bool Run(WebTestDelegate*, WebView* web_view) override {
blink::WebFrame* main_frame = web_view->MainFrame();
@@ -2061,7 +2063,8 @@ void TestRunner::QueueLoadingScript(const std::string& script) {
class WorkItemNonLoadingScript : public TestRunner::WorkItem {
public:
- WorkItemNonLoadingScript(const std::string& script) : script_(script) {}
+ explicit WorkItemNonLoadingScript(const std::string& script)
+ : script_(script) {}
bool Run(WebTestDelegate*, WebView* web_view) override {
blink::WebFrame* main_frame = web_view->MainFrame();
@@ -2102,8 +2105,17 @@ void TestRunner::QueueLoad(const std::string& url, const std::string& target) {
if (!main_view_)
return;
+ // TODO(lukasza): testRunner.queueLoad(...) should work even if the main frame
+ // is remote (ideally testRunner.queueLoad would bind to and execute in the
+ // context of a specific local frame - resolving relative urls should be done
+ // on relative to the calling frame's url).
+ CHECK(main_view_->MainFrame()->IsWebLocalFrame())
+ << "This function cannot be called if the main frame is not "
+ "a local frame.";
+
// FIXME: Implement WebURL::resolve() and avoid GURL.
- GURL current_url = main_view_->MainFrame()->GetDocument().Url();
+ GURL current_url =
+ main_view_->MainFrame()->ToWebLocalFrame()->GetDocument().Url();
GURL full_url = current_url.Resolve(url);
work_queue_.AddWork(new WorkItemLoad(full_url, target));
}
« no previous file with comments | « content/shell/test_runner/pixel_dump.cc ('k') | content/shell/test_runner/test_runner_for_specific_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698