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

Side by Side Diff: chrome/browser/automation/automation_provider.cc

Issue 242024: TestOverrideEncoding hanging is because TabProxy::WaitForNavigation can not g... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/browser_encoding_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/automation_provider.h" 5 #include "chrome/browser/automation/automation_provider.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/message_box_flags.h" 10 #include "app/message_box_flags.h"
(...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 NavigationController* controller = tab_tracker_->GetResource(tab_handle); 1339 NavigationController* controller = tab_tracker_->GetResource(tab_handle);
1340 int index; 1340 int index;
1341 Browser* browser = Browser::GetBrowserForController(controller, &index); 1341 Browser* browser = Browser::GetBrowserForController(controller, &index);
1342 DCHECK(browser); 1342 DCHECK(browser);
1343 new TabClosedNotificationObserver(this, wait_until_closed, reply_message); 1343 new TabClosedNotificationObserver(this, wait_until_closed, reply_message);
1344 browser->CloseContents(controller->tab_contents()); 1344 browser->CloseContents(controller->tab_contents());
1345 return; 1345 return;
1346 } 1346 }
1347 1347
1348 AutomationMsg_CloseTab::WriteReplyParams(reply_message, false); 1348 AutomationMsg_CloseTab::WriteReplyParams(reply_message, false);
1349 Send(reply_message);
1349 } 1350 }
1350 1351
1351 void AutomationProvider::CloseBrowser(int browser_handle, 1352 void AutomationProvider::CloseBrowser(int browser_handle,
1352 IPC::Message* reply_message) { 1353 IPC::Message* reply_message) {
1353 if (browser_tracker_->ContainsHandle(browser_handle)) { 1354 if (browser_tracker_->ContainsHandle(browser_handle)) {
1354 Browser* browser = browser_tracker_->GetResource(browser_handle); 1355 Browser* browser = browser_tracker_->GetResource(browser_handle);
1355 new BrowserClosedNotificationObserver(browser, this, 1356 new BrowserClosedNotificationObserver(browser, this,
1356 reply_message); 1357 reply_message);
1357 browser->window()->Close(); 1358 browser->window()->Close();
1358 } else { 1359 } else {
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1740 } 1741 }
1741 InfoBarDelegate* delegate = 1742 InfoBarDelegate* delegate =
1742 nav_controller->tab_contents()->GetInfoBarDelegateAt( 1743 nav_controller->tab_contents()->GetInfoBarDelegateAt(
1743 info_bar_index); 1744 info_bar_index);
1744 if (delegate->AsConfirmInfoBarDelegate()) 1745 if (delegate->AsConfirmInfoBarDelegate())
1745 delegate->AsConfirmInfoBarDelegate()->Accept(); 1746 delegate->AsConfirmInfoBarDelegate()->Accept();
1746 success = true; 1747 success = true;
1747 } 1748 }
1748 } 1749 }
1749 } 1750 }
1751
1752 // This "!wait_for_navigation || !success condition" logic looks suspicious.
1753 // It will send a failure message when success is true but
1754 // |wait_for_navigation| is false.
1755 // TODO(phajdan.jr): investgate whether the reply param (currently
1756 // AUTOMATION_MSG_NAVIGATION_ERROR) should depend on success.
1750 if (!wait_for_navigation || !success) 1757 if (!wait_for_navigation || !success)
1751 AutomationMsg_ClickSSLInfoBarLink::WriteReplyParams( 1758 AutomationMsg_ClickSSLInfoBarLink::WriteReplyParams(
1752 reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); 1759 reply_message, AUTOMATION_MSG_NAVIGATION_ERROR);
1753 } 1760 }
1754 1761
1755 void AutomationProvider::GetLastNavigationTime(int handle, 1762 void AutomationProvider::GetLastNavigationTime(int handle,
1756 int64* last_navigation_time) { 1763 int64* last_navigation_time) {
1757 Time time = tab_tracker_->GetLastNavigationTime(handle); 1764 Time time = tab_tracker_->GetLastNavigationTime(handle);
1758 *last_navigation_time = time.ToInternalValue(); 1765 *last_navigation_time = time.ToInternalValue();
1759 } 1766 }
1760 1767
1761 void AutomationProvider::WaitForNavigation(int handle, 1768 void AutomationProvider::WaitForNavigation(int handle,
1762 int64 last_navigation_time, 1769 int64 last_navigation_time,
1763 IPC::Message* reply_message) { 1770 IPC::Message* reply_message) {
1764 NavigationController* controller = tab_tracker_->GetResource(handle); 1771 NavigationController* controller = tab_tracker_->GetResource(handle);
1765 Time time = tab_tracker_->GetLastNavigationTime(handle); 1772 Time time = tab_tracker_->GetLastNavigationTime(handle);
1766 1773
1767 if (time.ToInternalValue() > last_navigation_time || !controller) { 1774 if (time.ToInternalValue() > last_navigation_time || !controller) {
1768 AutomationMsg_WaitForNavigation::WriteReplyParams(reply_message, 1775 AutomationMsg_WaitForNavigation::WriteReplyParams(reply_message,
1769 controller == NULL ? AUTOMATION_MSG_NAVIGATION_ERROR : 1776 controller == NULL ? AUTOMATION_MSG_NAVIGATION_ERROR :
1770 AUTOMATION_MSG_NAVIGATION_SUCCESS); 1777 AUTOMATION_MSG_NAVIGATION_SUCCESS);
1778 Send(reply_message);
1771 return; 1779 return;
1772 } 1780 }
1773 1781
1774 AddNavigationStatusListener(controller, reply_message, 1); 1782 AddNavigationStatusListener(controller, reply_message, 1);
1775 } 1783 }
1776 1784
1777 void AutomationProvider::SetIntPreference(int handle, 1785 void AutomationProvider::SetIntPreference(int handle,
1778 const std::wstring& name, 1786 const std::wstring& name,
1779 int value, 1787 int value,
1780 bool* success) { 1788 bool* success) {
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
2053 for (;iter != BrowserList::end(); ++iter) { 2061 for (;iter != BrowserList::end(); ++iter) {
2054 gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle(); 2062 gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle();
2055 if (window == this_window) { 2063 if (window == this_window) {
2056 // Add() returns the existing handle for the resource if any. 2064 // Add() returns the existing handle for the resource if any.
2057 *browser_handle = browser_tracker_->Add(*iter); 2065 *browser_handle = browser_tracker_->Add(*iter);
2058 *success = true; 2066 *success = true;
2059 return; 2067 return;
2060 } 2068 }
2061 } 2069 }
2062 } 2070 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_encoding_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698