Chromium Code Reviews| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 | 118 |
| 119 bool PyUITestBase::RunCommand(int browser_command, int window_index) { | 119 bool PyUITestBase::RunCommand(int browser_command, int window_index) { |
| 120 scoped_refptr<BrowserProxy> browser_proxy = | 120 scoped_refptr<BrowserProxy> browser_proxy = |
| 121 automation()->GetBrowserWindow(window_index); | 121 automation()->GetBrowserWindow(window_index); |
| 122 EXPECT_TRUE(browser_proxy.get()); | 122 EXPECT_TRUE(browser_proxy.get()); |
| 123 if (!browser_proxy.get()) | 123 if (!browser_proxy.get()) |
| 124 return false; | 124 return false; |
| 125 return browser_proxy->RunCommand(browser_command); | 125 return browser_proxy->RunCommand(browser_command); |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool PyUITestBase::IsMenuCommandEnabled(int id, int window_index) { | |
| 129 scoped_refptr<BrowserProxy> browser_proxy = | |
| 130 automation()->GetBrowserWindow(window_index); | |
|
Paweł Hajdan Jr.
2011/10/27 08:26:21
Please NULL-check this. It *will* crash randomly i
Joao da Silva
2011/11/03 18:00:10
Thanks for driving-by :-) Done.
| |
| 131 bool enabled = true; | |
| 132 EXPECT_TRUE(browser_proxy->IsMenuCommandEnabled(id, &enabled)); | |
| 133 return enabled; | |
| 134 } | |
| 135 | |
| 128 bool PyUITestBase::ActivateTab(int tab_index, int window_index) { | 136 bool PyUITestBase::ActivateTab(int tab_index, int window_index) { |
| 129 scoped_refptr<BrowserProxy> browser_proxy = | 137 scoped_refptr<BrowserProxy> browser_proxy = |
| 130 automation()->GetBrowserWindow(window_index); | 138 automation()->GetBrowserWindow(window_index); |
| 131 return browser_proxy->BringToFront() && browser_proxy->ActivateTab(tab_index); | 139 return browser_proxy->BringToFront() && browser_proxy->ActivateTab(tab_index); |
| 132 } | 140 } |
| 133 | 141 |
| 134 void PyUITestBase::SetDownloadShelfVisible(bool is_visible, int window_index) { | 142 void PyUITestBase::SetDownloadShelfVisible(bool is_visible, int window_index) { |
| 135 scoped_refptr<BrowserProxy> browser_proxy = | 143 scoped_refptr<BrowserProxy> browser_proxy = |
| 136 automation()->GetBrowserWindow(window_index); | 144 automation()->GetBrowserWindow(window_index); |
| 137 ASSERT_TRUE(browser_proxy.get()); | 145 ASSERT_TRUE(browser_proxy.get()); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 393 // TODO(phadjan.jr): figure out a way to unambiguously report error. | 401 // TODO(phadjan.jr): figure out a way to unambiguously report error. |
| 394 if (!browser_proxy.get()) | 402 if (!browser_proxy.get()) |
| 395 return cookie_val; | 403 return cookie_val; |
| 396 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); | 404 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); |
| 397 EXPECT_TRUE(tab_proxy.get()); | 405 EXPECT_TRUE(tab_proxy.get()); |
| 398 if (!tab_proxy.get()) | 406 if (!tab_proxy.get()) |
| 399 return cookie_val; | 407 return cookie_val; |
| 400 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); | 408 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); |
| 401 return cookie_val; | 409 return cookie_val; |
| 402 } | 410 } |
| OLD | NEW |