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

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: Addressed Nirnimesh's comments. 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
« no previous file with comments | « chrome/test/pyautolib/pyautolib.h ('k') | chrome/test/pyautolib/pyautolib.i » ('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) 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Clear the homepage because some of the pyauto tests don't work correctly 92 // Clear the homepage because some of the pyauto tests don't work correctly
93 // if a URL argument is passed. 93 // if a URL argument is passed.
94 std::string homepage_original; 94 std::string homepage_original;
95 std::swap(homepage_original, homepage_); 95 std::swap(homepage_original, homepage_);
96 96
97 UITestBase::SetLaunchSwitches(); 97 UITestBase::SetLaunchSwitches();
98 98
99 // However, we *do* want the --homepage switch. 99 // However, we *do* want the --homepage switch.
100 std::swap(homepage_original, homepage_); 100 std::swap(homepage_original, homepage_);
101 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_); 101 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_);
102
103 }
104
105 void PyUITestBase::NavigateToURL(const char* url_string) {
106 GURL url(url_string);
107 UITestBase::NavigateToURL(url);
108 }
109
110 void PyUITestBase::NavigateToURL(const char* url_string, int window_index) {
111 GURL url(url_string);
112 UITestBase::NavigateToURL(url, window_index);
113 }
114
115 void PyUITestBase::NavigateToURL(
116 const char* url_string, int window_index, int tab_index) {
117 GURL url(url_string);
118 UITestBase::NavigateToURL(url, window_index, tab_index);
119 }
120
121 void PyUITestBase::ReloadActiveTab(int window_index) {
122 scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
123 ASSERT_TRUE(tab_proxy.get());
124 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab_proxy->Reload());
125 }
126
127 bool PyUITestBase::AppendTab(const GURL& tab_url, int window_index) {
128 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index);
129 return browser_proxy->AppendTab(tab_url);
130 } 102 }
131 103
132 bool PyUITestBase::ApplyAccelerator(int id, int window_index) { 104 bool PyUITestBase::ApplyAccelerator(int id, int window_index) {
133 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); 105 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index);
134 return browser_proxy->ApplyAccelerator(id); 106 return browser_proxy->ApplyAccelerator(id);
135 } 107 }
136 108
137 bool PyUITestBase::RunCommand(int browser_command, int window_index) { 109 bool PyUITestBase::RunCommand(int browser_command, int window_index) {
138 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); 110 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index);
139 EXPECT_TRUE(browser_proxy.get()); 111 EXPECT_TRUE(browser_proxy.get());
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 // TODO(phadjan.jr): figure out a way to unambiguously report error. 418 // TODO(phadjan.jr): figure out a way to unambiguously report error.
447 if (!browser_proxy.get()) 419 if (!browser_proxy.get())
448 return cookie_val; 420 return cookie_val;
449 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); 421 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index);
450 EXPECT_TRUE(tab_proxy.get()); 422 EXPECT_TRUE(tab_proxy.get());
451 if (!tab_proxy.get()) 423 if (!tab_proxy.get())
452 return cookie_val; 424 return cookie_val;
453 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); 425 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val));
454 return cookie_val; 426 return cookie_val;
455 } 427 }
OLDNEW
« no previous file with comments | « chrome/test/pyautolib/pyautolib.h ('k') | chrome/test/pyautolib/pyautolib.i » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698