OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/logging.h" | 6 #include "base/logging.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 std::string homepage_original; | 94 std::string homepage_original; |
95 std::swap(homepage_original, homepage_); | 95 std::swap(homepage_original, homepage_); |
96 | 96 |
97 UITestBase::SetLaunchSwitches(); | 97 UITestBase::SetLaunchSwitches(); |
98 | 98 |
99 // However, we *do* want the --homepage switch. | 99 // However, we *do* want the --homepage switch. |
100 std::swap(homepage_original, homepage_); | 100 std::swap(homepage_original, homepage_); |
101 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_); | 101 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_); |
102 } | 102 } |
103 | 103 |
104 bool PyUITestBase::ActivateTab(int tab_index, int window_index) { | |
105 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | |
106 return browser_proxy->BringToFront() && browser_proxy->ActivateTab(tab_index); | |
107 } | |
108 | |
109 void PyUITestBase::SetDownloadShelfVisible(bool is_visible, int window_index) { | 104 void PyUITestBase::SetDownloadShelfVisible(bool is_visible, int window_index) { |
110 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | 105 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); |
111 ASSERT_TRUE(browser_proxy.get()); | 106 ASSERT_TRUE(browser_proxy.get()); |
112 EXPECT_TRUE(browser_proxy->SetShelfVisible(is_visible)); | 107 EXPECT_TRUE(browser_proxy->SetShelfVisible(is_visible)); |
113 } | 108 } |
114 | 109 |
115 bool PyUITestBase::IsDownloadShelfVisible(int window_index) { | 110 bool PyUITestBase::IsDownloadShelfVisible(int window_index) { |
116 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | 111 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); |
117 EXPECT_TRUE(browser_proxy.get()); | 112 EXPECT_TRUE(browser_proxy.get()); |
118 if (!browser_proxy.get()) | 113 if (!browser_proxy.get()) |
119 return false; | 114 return false; |
120 bool visible = false; | 115 bool visible = false; |
121 EXPECT_TRUE(browser_proxy->IsShelfVisible(&visible)); | 116 EXPECT_TRUE(browser_proxy->IsShelfVisible(&visible)); |
122 return visible; | 117 return visible; |
123 } | 118 } |
124 | 119 |
125 int PyUITestBase::GetTabCount(int window_index) { | |
126 return UITestBase::GetTabCount(window_index); | |
127 } | |
128 | |
129 GURL PyUITestBase::GetActiveTabURL(int window_index) { | |
130 return UITestBase::GetActiveTabURL(window_index); | |
131 } | |
132 | |
133 void PyUITestBase::OpenFindInPage(int window_index) { | 120 void PyUITestBase::OpenFindInPage(int window_index) { |
134 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | 121 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); |
135 ASSERT_TRUE(browser_proxy.get()); | 122 ASSERT_TRUE(browser_proxy.get()); |
136 EXPECT_TRUE(browser_proxy->OpenFindInPage()); | 123 EXPECT_TRUE(browser_proxy->OpenFindInPage()); |
137 } | 124 } |
138 | 125 |
139 bool PyUITestBase::IsFindInPageVisible(int window_index) { | 126 bool PyUITestBase::IsFindInPageVisible(int window_index) { |
140 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | 127 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); |
141 EXPECT_TRUE(browser_proxy.get()); | 128 EXPECT_TRUE(browser_proxy.get()); |
142 if (!browser_proxy.get()) | 129 if (!browser_proxy.get()) |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 // TODO(phadjan.jr): figure out a way to unambiguously report error. | 383 // TODO(phadjan.jr): figure out a way to unambiguously report error. |
397 if (!browser_proxy.get()) | 384 if (!browser_proxy.get()) |
398 return cookie_val; | 385 return cookie_val; |
399 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); | 386 scoped_refptr<TabProxy> tab_proxy = browser_proxy->GetTab(tab_index); |
400 EXPECT_TRUE(tab_proxy.get()); | 387 EXPECT_TRUE(tab_proxy.get()); |
401 if (!tab_proxy.get()) | 388 if (!tab_proxy.get()) |
402 return cookie_val; | 389 return cookie_val; |
403 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); | 390 EXPECT_TRUE(tab_proxy->GetCookies(cookie_url, &cookie_val)); |
404 return cookie_val; | 391 return cookie_val; |
405 } | 392 } |
OLD | NEW |