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

Side by Side Diff: chrome/test/automation/tab_proxy.cc

Issue 174015: Add automation call to wait for multiple navigations. (Closed)
Patch Set: backwards compatibility, properly done Created 11 years, 4 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
« no previous file with comments | « chrome/test/automation/tab_proxy.h ('k') | chrome/test/memory_test/memory_test.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/test/automation/tab_proxy.h" 5 #include "chrome/test/automation/tab_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/common/json_value_serializer.h" 10 #include "chrome/common/json_value_serializer.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 &matches)); 64 &matches));
65 if (!succeeded) 65 if (!succeeded)
66 return -1; 66 return -1;
67 if (ordinal) 67 if (ordinal)
68 *ordinal = ordinal2; 68 *ordinal = ordinal2;
69 return matches; 69 return matches;
70 } 70 }
71 71
72 AutomationMsg_NavigationResponseValues TabProxy::NavigateToURL( 72 AutomationMsg_NavigationResponseValues TabProxy::NavigateToURL(
73 const GURL& url) { 73 const GURL& url) {
74 return NavigateToURLWithTimeout(url, base::kNoTimeout, NULL); 74 return NavigateToURLBlockUntilNavigationsComplete(url, 1);
75 }
76
77 AutomationMsg_NavigationResponseValues
78 TabProxy::NavigateToURLBlockUntilNavigationsComplete(
79 const GURL& url, int number_of_navigations) {
80 return NavigateToURLWithTimeout(url, number_of_navigations, base::kNoTimeout,
81 NULL);
75 } 82 }
76 83
77 AutomationMsg_NavigationResponseValues TabProxy::NavigateToURLWithTimeout( 84 AutomationMsg_NavigationResponseValues TabProxy::NavigateToURLWithTimeout(
78 const GURL& url, uint32 timeout_ms, bool* is_timeout) { 85 const GURL& url, int number_of_navigations, uint32 timeout_ms,
86 bool* is_timeout) {
79 if (!is_valid()) 87 if (!is_valid())
80 return AUTOMATION_MSG_NAVIGATION_ERROR; 88 return AUTOMATION_MSG_NAVIGATION_ERROR;
81 89
82 AutomationMsg_NavigationResponseValues navigate_response = 90 AutomationMsg_NavigationResponseValues navigate_response =
83 AUTOMATION_MSG_NAVIGATION_ERROR; 91 AUTOMATION_MSG_NAVIGATION_ERROR;
84 92
85 sender_->SendWithTimeout(new AutomationMsg_NavigateToURL( 93 if (number_of_navigations == 1) {
86 0, handle_, url, &navigate_response), timeout_ms, is_timeout); 94 // TODO(phajdan.jr): Remove when the reference build gets updated.
95 // This is only for backwards compatibility.
96 sender_->SendWithTimeout(
97 new AutomationMsg_NavigateToURL(
98 0, handle_, url, &navigate_response),
99 timeout_ms, is_timeout);
100 } else {
101 sender_->SendWithTimeout(
102 new AutomationMsg_NavigateToURLBlockUntilNavigationsComplete(
103 0, handle_, url, number_of_navigations, &navigate_response),
104 timeout_ms, is_timeout);
105 }
87 106
88 return navigate_response; 107 return navigate_response;
89 } 108 }
90 109
91 AutomationMsg_NavigationResponseValues TabProxy::NavigateInExternalTab( 110 AutomationMsg_NavigationResponseValues TabProxy::NavigateInExternalTab(
92 const GURL& url) { 111 const GURL& url) {
93 if (!is_valid()) 112 if (!is_valid())
94 return AUTOMATION_MSG_NAVIGATION_ERROR; 113 return AUTOMATION_MSG_NAVIGATION_ERROR;
95 114
96 AutomationMsg_NavigationResponseValues rv = AUTOMATION_MSG_NAVIGATION_ERROR; 115 AutomationMsg_NavigationResponseValues rv = AUTOMATION_MSG_NAVIGATION_ERROR;
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 AutoLock lock(list_lock_); 698 AutoLock lock(list_lock_);
680 observers_list_.RemoveObserver(observer); 699 observers_list_.RemoveObserver(observer);
681 } 700 }
682 701
683 // Called on Channel background thread, if TabMessages filter is installed. 702 // Called on Channel background thread, if TabMessages filter is installed.
684 void TabProxy::OnMessageReceived(const IPC::Message& message) { 703 void TabProxy::OnMessageReceived(const IPC::Message& message) {
685 AutoLock lock(list_lock_); 704 AutoLock lock(list_lock_);
686 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_, 705 FOR_EACH_OBSERVER(TabProxyDelegate, observers_list_,
687 OnMessageReceived(this, message)); 706 OnMessageReceived(this, message));
688 } 707 }
OLDNEW
« no previous file with comments | « chrome/test/automation/tab_proxy.h ('k') | chrome/test/memory_test/memory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698