| OLD | NEW |
| 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_number_conversions.h" | 6 #include "base/string_number_conversions.h" |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/test/automation/extension_proxy.h" | 9 #include "chrome/test/automation/extension_proxy.h" |
| 10 #include "chrome/test/automation/tab_proxy.h" | 10 #include "chrome/test/automation/tab_proxy.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 if (!tab_proxy.get()) | 164 if (!tab_proxy.get()) |
| 165 return download_dir; | 165 return download_dir; |
| 166 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_dir)); | 166 EXPECT_TRUE(tab_proxy->GetDownloadDirectory(&download_dir)); |
| 167 return download_dir; | 167 return download_dir; |
| 168 } | 168 } |
| 169 | 169 |
| 170 bool PyUITestBase::OpenNewBrowserWindow(bool show) { | 170 bool PyUITestBase::OpenNewBrowserWindow(bool show) { |
| 171 return automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, show); | 171 return automation()->OpenNewBrowserWindow(Browser::TYPE_NORMAL, show); |
| 172 } | 172 } |
| 173 | 173 |
| 174 bool PyUITestBase::CloseBrowserWindow(int window_index) { |
| 175 scoped_refptr<BrowserProxy> browser_proxy = |
| 176 automation()->GetBrowserWindow(window_index); |
| 177 if (!browser_proxy.get()) |
| 178 return false; |
| 179 bool app_closed; |
| 180 return CloseBrowser(browser_proxy.get(), &app_closed); |
| 181 } |
| 182 |
| 174 int PyUITestBase::GetBrowserWindowCount() { | 183 int PyUITestBase::GetBrowserWindowCount() { |
| 175 int num_windows = 0; | 184 int num_windows = 0; |
| 176 EXPECT_TRUE(automation()->GetBrowserWindowCount(&num_windows)); | 185 EXPECT_TRUE(automation()->GetBrowserWindowCount(&num_windows)); |
| 177 return num_windows; | 186 return num_windows; |
| 178 } | 187 } |
| 179 | 188 |
| 180 bool PyUITestBase::InstallExtension(const FilePath& crx_file, bool with_ui) { | 189 bool PyUITestBase::InstallExtension(const FilePath& crx_file, bool with_ui) { |
| 181 scoped_refptr<ExtensionProxy> proxy = | 190 scoped_refptr<ExtensionProxy> proxy = |
| 182 automation()->InstallExtension(crx_file, with_ui); | 191 automation()->InstallExtension(crx_file, with_ui); |
| 183 return proxy.get() != NULL; | 192 return proxy.get() != NULL; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // TODO(phadjan.jr): figure out a way to unambiguously report error. | 373 // TODO(phadjan.jr): figure out a way to unambiguously report error. |
| 365 if (!browser_proxy.get()) | 374 if (!browser_proxy.get()) |
| 366 return cookie_val; | 375 return cookie_val; |
| 367 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); | 376 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); |
| 368 EXPECT_TRUE(tab_proxy.get()); | 377 EXPECT_TRUE(tab_proxy.get()); |
| 369 if (!tab_proxy.get()) | 378 if (!tab_proxy.get()) |
| 370 return cookie_val; | 379 return cookie_val; |
| 371 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); | 380 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); |
| 372 return cookie_val; | 381 return cookie_val; |
| 373 } | 382 } |
| OLD | NEW |