Upstream version 7.35.139.0
[platform/framework/web/crosswalk.git] / src / content / shell / renderer / test_runner / test_runner.cc
index de6d749..e7e2a01 100644 (file)
@@ -222,6 +222,7 @@ class TestRunnerBindings : public gin::Wrappable<TestRunnerBindings> {
   void SetWillSendRequestClearHeader(const std::string& header);
   void DumpResourceRequestPriorities();
   void SetUseMockTheme(bool use);
+  void WaitUntilExternalURLLoad();
   void ShowWebInspector(gin::Arguments* args);
   void CloseWebInspector();
   bool IsChooserShown();
@@ -443,6 +444,8 @@ gin::ObjectTemplateBuilder TestRunnerBindings::GetObjectTemplateBuilder(
       .SetMethod("dumpResourceRequestPriorities",
                  &TestRunnerBindings::DumpResourceRequestPriorities)
       .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme)
+      .SetMethod("waitUntilExternalURLLoad",
+                 &TestRunnerBindings::WaitUntilExternalURLLoad)
       .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector)
       .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector)
       .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown)
@@ -1102,6 +1105,11 @@ void TestRunnerBindings::SetUseMockTheme(bool use) {
     runner_->SetUseMockTheme(use);
 }
 
+void TestRunnerBindings::WaitUntilExternalURLLoad() {
+  if (runner_)
+    runner_->WaitUntilExternalURLLoad();
+}
+
 void TestRunnerBindings::ShowWebInspector(gin::Arguments* args) {
   if (runner_) {
     std::string str;
@@ -1421,6 +1429,7 @@ void TestRunner::Reset() {
 
   top_loading_frame_ = NULL;
   wait_until_done_ = false;
+  wait_until_external_url_load_ = false;
   policy_delegate_enabled_ = false;
   policy_delegate_is_permissive_ = false;
   policy_delegate_should_notify_done_ = false;
@@ -1637,6 +1646,10 @@ bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const {
   return should_stay_on_page_after_handling_before_unload_;
 }
 
+bool TestRunner::shouldWaitUntilExternalURLLoad() const {
+  return wait_until_external_url_load_;
+}
+
 const std::set<std::string>* TestRunner::httpHeadersToClear() const {
   return &http_headers_to_clear_;
 }
@@ -2463,6 +2476,10 @@ void TestRunner::ShowWebInspector(const std::string& str) {
   showDevTools(str);
 }
 
+void TestRunner::WaitUntilExternalURLLoad() {
+  wait_until_external_url_load_ = true;
+}
+
 void TestRunner::CloseWebInspector() {
   delegate_->closeDevTools();
 }