| OLD | NEW |
| 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" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 bool PyUITestBase::RunCommand(int browser_command, int window_index) { | 121 bool PyUITestBase::RunCommand(int browser_command, int window_index) { |
| 122 scoped_refptr<BrowserProxy> browser_proxy = | 122 scoped_refptr<BrowserProxy> browser_proxy = |
| 123 automation()->GetBrowserWindow(window_index); | 123 automation()->GetBrowserWindow(window_index); |
| 124 EXPECT_TRUE(browser_proxy.get()); | 124 EXPECT_TRUE(browser_proxy.get()); |
| 125 if (!browser_proxy.get()) | 125 if (!browser_proxy.get()) |
| 126 return false; | 126 return false; |
| 127 return browser_proxy->RunCommand(browser_command); | 127 return browser_proxy->RunCommand(browser_command); |
| 128 } | 128 } |
| 129 | 129 |
| 130 bool PyUITestBase::IsMenuCommandEnabled(int id, int window_index) { |
| 131 scoped_refptr<BrowserProxy> browser_proxy = |
| 132 automation()->GetBrowserWindow(window_index); |
| 133 EXPECT_TRUE(browser_proxy.get()); |
| 134 bool enabled = false; |
| 135 if (browser_proxy.get()) |
| 136 EXPECT_TRUE(browser_proxy->IsMenuCommandEnabled(id, &enabled)); |
| 137 return enabled; |
| 138 } |
| 139 |
| 130 bool PyUITestBase::ActivateTab(int tab_index, int window_index) { | 140 bool PyUITestBase::ActivateTab(int tab_index, int window_index) { |
| 131 scoped_refptr<BrowserProxy> browser_proxy = | 141 scoped_refptr<BrowserProxy> browser_proxy = |
| 132 automation()->GetBrowserWindow(window_index); | 142 automation()->GetBrowserWindow(window_index); |
| 133 return browser_proxy->BringToFront() && browser_proxy->ActivateTab(tab_index); | 143 return browser_proxy->BringToFront() && browser_proxy->ActivateTab(tab_index); |
| 134 } | 144 } |
| 135 | 145 |
| 136 void PyUITestBase::SetDownloadShelfVisible(bool is_visible, int window_index) { | 146 void PyUITestBase::SetDownloadShelfVisible(bool is_visible, int window_index) { |
| 137 scoped_refptr<BrowserProxy> browser_proxy = | 147 scoped_refptr<BrowserProxy> browser_proxy = |
| 138 automation()->GetBrowserWindow(window_index); | 148 automation()->GetBrowserWindow(window_index); |
| 139 ASSERT_TRUE(browser_proxy.get()); | 149 ASSERT_TRUE(browser_proxy.get()); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 // TODO(phadjan.jr): figure out a way to unambiguously report error. | 405 // TODO(phadjan.jr): figure out a way to unambiguously report error. |
| 396 if (!browser_proxy.get()) | 406 if (!browser_proxy.get()) |
| 397 return cookie_val; | 407 return cookie_val; |
| 398 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); | 408 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); |
| 399 EXPECT_TRUE(tab_proxy.get()); | 409 EXPECT_TRUE(tab_proxy.get()); |
| 400 if (!tab_proxy.get()) | 410 if (!tab_proxy.get()) |
| 401 return cookie_val; | 411 return cookie_val; |
| 402 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); | 412 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); |
| 403 return cookie_val; | 413 return cookie_val; |
| 404 } | 414 } |
| OLD | NEW |