OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/automation/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 6070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6081 Browser* browser; | 6081 Browser* browser; |
6082 WebContents* web_contents; | 6082 WebContents* web_contents; |
6083 if (!GetBrowserAndTabFromJSONArgs(args, &browser, &web_contents, &error)) { | 6083 if (!GetBrowserAndTabFromJSONArgs(args, &browser, &web_contents, &error)) { |
6084 AutomationJSONReply(this, reply_message).SendError(error); | 6084 AutomationJSONReply(this, reply_message).SendError(error); |
6085 return; | 6085 return; |
6086 } | 6086 } |
6087 NavigationNotificationObserver* observer = | 6087 NavigationNotificationObserver* observer = |
6088 new NavigationNotificationObserver(&web_contents->GetController(), this, | 6088 new NavigationNotificationObserver(&web_contents->GetController(), this, |
6089 reply_message, 1, true, true); | 6089 reply_message, 1, true, true); |
6090 if (!web_contents->IsLoading()) { | 6090 if (!web_contents->IsLoading()) { |
6091 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 6091 observer->ConditionMet(AUTOMATION_MSG_NAVIGATION_SUCCESS); |
6092 delete observer; | |
6093 return; | 6092 return; |
6094 } | 6093 } |
6095 } | 6094 } |
6096 | 6095 |
6097 void TestingAutomationProvider::ExecuteJavascriptJSON( | 6096 void TestingAutomationProvider::ExecuteJavascriptJSON( |
6098 DictionaryValue* args, | 6097 DictionaryValue* args, |
6099 IPC::Message* reply_message) { | 6098 IPC::Message* reply_message) { |
6100 if (SendErrorIfModalDialogActive(this, reply_message)) | 6099 if (SendErrorIfModalDialogActive(this, reply_message)) |
6101 return; | 6100 return; |
6102 | 6101 |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6668 } | 6667 } |
6669 | 6668 |
6670 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6669 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6671 WebContents* tab) { | 6670 WebContents* tab) { |
6672 if (browser->GetActiveWebContents() != tab || | 6671 if (browser->GetActiveWebContents() != tab || |
6673 browser != BrowserList::GetLastActive()) { | 6672 browser != BrowserList::GetLastActive()) { |
6674 browser->ActivateTabAt(browser->GetIndexOfController(&tab->GetController()), | 6673 browser->ActivateTabAt(browser->GetIndexOfController(&tab->GetController()), |
6675 true /* user_gesture */); | 6674 true /* user_gesture */); |
6676 } | 6675 } |
6677 } | 6676 } |
OLD | NEW |