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

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

Issue 8649004: Allow chromedriver to install an extension and get all installed extension IDs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/string_number_conversions.h" 8 #include "base/string_number_conversions.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/test/automation/automation_proxy.h" 11 #include "chrome/test/automation/automation_proxy.h"
12 #include "chrome/test/automation/extension_proxy.h"
13 #include "chrome/test/automation/tab_proxy.h" 12 #include "chrome/test/automation/tab_proxy.h"
14 #include "chrome/test/pyautolib/pyautolib.h" 13 #include "chrome/test/pyautolib/pyautolib.h"
15 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
16 15
17 static int64 StringToId(const std::wstring& str) { 16 static int64 StringToId(const std::wstring& str) {
18 int64 id; 17 int64 id;
19 base::StringToInt64(WideToUTF8(str), &id); 18 base::StringToInt64(WideToUTF8(str), &id);
20 return id; 19 return id;
21 } 20 }
22 21
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool app_closed; 208 bool app_closed;
210 return CloseBrowser(browser_proxy.get(), &app_closed); 209 return CloseBrowser(browser_proxy.get(), &app_closed);
211 } 210 }
212 211
213 int PyUITestBase::GetBrowserWindowCount() { 212 int PyUITestBase::GetBrowserWindowCount() {
214 int num_windows = 0; 213 int num_windows = 0;
215 EXPECT_TRUE(automation()->GetBrowserWindowCount(&num_windows)); 214 EXPECT_TRUE(automation()->GetBrowserWindowCount(&num_windows));
216 return num_windows; 215 return num_windows;
217 } 216 }
218 217
219 std::string PyUITestBase::InstallExtension(const std::string& extension_path,
220 bool with_ui) {
221 #if defined(OS_WIN)
222 FilePath extension_file_path = FilePath(ASCIIToWide(extension_path));
223 #else
224 FilePath extension_file_path = FilePath(extension_path);
225 #endif
226 scoped_refptr<ExtensionProxy> proxy =
227 automation()->InstallExtension(extension_file_path, with_ui);
228 std::string id;
229 if (!proxy.get() || !proxy.get()->GetId(&id))
230 return "";
231 return id;
232 }
233
234 bool PyUITestBase::GetBookmarkBarState(bool* visible, bool* detached) { 218 bool PyUITestBase::GetBookmarkBarState(bool* visible, bool* detached) {
235 scoped_refptr<BrowserProxy> browser_proxy = 219 scoped_refptr<BrowserProxy> browser_proxy =
236 automation()->GetBrowserWindow(0); // Window doesn't matter. 220 automation()->GetBrowserWindow(0); // Window doesn't matter.
237 EXPECT_TRUE(browser_proxy.get()); 221 EXPECT_TRUE(browser_proxy.get());
238 if (!browser_proxy.get()) 222 if (!browser_proxy.get())
239 return false; 223 return false;
240 224
241 // We have no use for animating in this context. 225 // We have no use for animating in this context.
242 bool animating; 226 bool animating;
243 EXPECT_TRUE(browser_proxy->GetBookmarkBarVisibility(visible, 227 EXPECT_TRUE(browser_proxy->GetBookmarkBarVisibility(visible,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 // TODO(phadjan.jr): figure out a way to unambiguously report error. 389 // TODO(phadjan.jr): figure out a way to unambiguously report error.
406 if (!browser_proxy.get()) 390 if (!browser_proxy.get())
407 return cookie_val; 391 return cookie_val;
408 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); 392 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index);
409 EXPECT_TRUE(tab_proxy.get()); 393 EXPECT_TRUE(tab_proxy.get());
410 if (!tab_proxy.get()) 394 if (!tab_proxy.get())
411 return cookie_val; 395 return cookie_val;
412 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); 396 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val));
413 return cookie_val; 397 return cookie_val;
414 } 398 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698