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

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

Issue 2903008: Expose cookie get/set to pyauto (Closed)
Patch Set: Final Created 10 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
« 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_ptr.h" 5 #include "base/scoped_ptr.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/test/automation/extension_proxy.h" 8 #include "chrome/test/automation/extension_proxy.h"
9 #include "chrome/test/automation/tab_proxy.h" 9 #include "chrome/test/automation/tab_proxy.h"
10 #include "chrome/test/pyautolib/pyautolib.h" 10 #include "chrome/test/pyautolib/pyautolib.h"
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 std::string response; 291 std::string response;
292 if (browser_proxy.get()) { 292 if (browser_proxy.get()) {
293 EXPECT_TRUE(browser_proxy->SendJSONRequest(request, &response)); 293 EXPECT_TRUE(browser_proxy->SendJSONRequest(request, &response));
294 } 294 }
295 return response; 295 return response;
296 } 296 }
297 297
298 bool PyUITestBase::ResetToDefaultTheme() { 298 bool PyUITestBase::ResetToDefaultTheme() {
299 return automation()->ResetToDefaultTheme(); 299 return automation()->ResetToDefaultTheme();
300 } 300 }
301
302 bool PyUITestBase::SetCookie(const GURL& cookie_url,
303 const std::string& value,
304 int window_index,
305 int tab_index) {
306 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index);
307 EXPECT_TRUE(browser_proxy.get());
308 if (!browser_proxy.get())
309 return false;
310 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index);
311 EXPECT_TRUE(tab_proxy.get());
312 if (!tab_proxy.get())
313 return false;
314 return tab_proxy->SetCookie(cookie_url, value);
315 }
316
317 std::string PyUITestBase::GetCookie(const GURL& cookie_url,
318 int window_index,
319 int tab_index) {
320 std::string cookie_val;
321 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index);
322 EXPECT_TRUE(browser_proxy.get());
323 // TODO(phadjan.jr): figure out a way to unambiguously report error.
324 if (!browser_proxy.get())
325 return cookie_val;
326 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index);
327 EXPECT_TRUE(tab_proxy.get());
328 if (!tab_proxy.get())
329 return cookie_val;
330 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val));
331 return cookie_val;
332 }
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