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

Side by Side Diff: chrome/test/pyautolib/pyautolib.cc

Issue 10692067: Convert PyAuto's NavigateToURL, GetActiveTabIndex, Refresh, RefreshActiveTab, and AppendTab to the … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed GetActiveTabIndex from the SWIG interface file. Created 8 years, 5 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
OLDNEW
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 "base/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // Clear the homepage because some of the pyauto tests don't work correctly 91 // Clear the homepage because some of the pyauto tests don't work correctly
92 // if a URL argument is passed. 92 // if a URL argument is passed.
93 std::string homepage_original; 93 std::string homepage_original;
94 std::swap(homepage_original, homepage_); 94 std::swap(homepage_original, homepage_);
95 95
96 UITestBase::SetLaunchSwitches(); 96 UITestBase::SetLaunchSwitches();
97 97
98 // However, we *do* want the --homepage switch. 98 // However, we *do* want the --homepage switch.
99 std::swap(homepage_original, homepage_); 99 std::swap(homepage_original, homepage_);
100 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_); 100 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_);
101
102 }
103
104 void PyUITestBase::NavigateToURL(const char* url_string) {
105 GURL url(url_string);
106 UITestBase::NavigateToURL(url);
107 }
108
109 void PyUITestBase::NavigateToURL(const char* url_string, int window_index) {
110 GURL url(url_string);
111 UITestBase::NavigateToURL(url, window_index);
112 }
113
114 void PyUITestBase::NavigateToURL(
115 const char* url_string, int window_index, int tab_index) {
116 GURL url(url_string);
117 UITestBase::NavigateToURL(url, window_index, tab_index);
118 }
119
120 void PyUITestBase::ReloadActiveTab(int window_index) {
121 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
122 ASSERT_TRUE(tab_proxy.get());
123 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->Reload());
124 }
125
126 bool PyUITestBase::AppendTab(const GURL& tab_url, int window_index) {
127 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index);
128 return browser_proxy->AppendTab(tab_url);
129 } 101 }
130 102
131 bool PyUITestBase::ApplyAccelerator(int id, int window_index) { 103 bool PyUITestBase::ApplyAccelerator(int id, int window_index) {
132 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); 104 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index);
133 return browser_proxy->ApplyAccelerator(id); 105 return browser_proxy->ApplyAccelerator(id);
134 } 106 }
135 107
136 bool PyUITestBase::RunCommand(int browser_command, int window_index) { 108 bool PyUITestBase::RunCommand(int browser_command, int window_index) {
137 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); 109 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index);
138 EXPECT_TRUE(browser_proxy.get()); 110 EXPECT_TRUE(browser_proxy.get());
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 // TODO(phadjan.jr): figure out a way to unambiguously report error. 399 // TODO(phadjan.jr): figure out a way to unambiguously report error.
428 if (!browser_proxy.get()) 400 if (!browser_proxy.get())
429 return cookie_val; 401 return cookie_val;
430 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); 402 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index);
431 EXPECT_TRUE(tab_proxy.get()); 403 EXPECT_TRUE(tab_proxy.get());
432 if (!tab_proxy.get()) 404 if (!tab_proxy.get())
433 return cookie_val; 405 return cookie_val;
434 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); 406 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val));
435 return cookie_val; 407 return cookie_val;
436 } 408 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698