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/json/json_writer.h" | 6 #include "base/json/json_writer.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 std::string homepage_original; | 95 std::string homepage_original; |
96 std::swap(homepage_original, homepage_); | 96 std::swap(homepage_original, homepage_); |
97 | 97 |
98 UITestBase::SetLaunchSwitches(); | 98 UITestBase::SetLaunchSwitches(); |
99 | 99 |
100 // However, we *do* want the --homepage switch. | 100 // However, we *do* want the --homepage switch. |
101 std::swap(homepage_original, homepage_); | 101 std::swap(homepage_original, homepage_); |
102 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_); | 102 launch_arguments_.AppendSwitchASCII(switches::kHomePage, homepage_); |
103 } | 103 } |
104 | 104 |
105 void PyUITestBase::OpenFindInPage(int window_index) { | |
106 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | |
107 ASSERT_TRUE(browser_proxy.get()); | |
108 EXPECT_TRUE(browser_proxy->OpenFindInPage()); | |
109 } | |
110 | |
111 bool PyUITestBase::IsFindInPageVisible(int window_index) { | |
112 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | |
113 EXPECT_TRUE(browser_proxy.get()); | |
114 if (!browser_proxy.get()) | |
115 return false; | |
116 bool is_visible; | |
117 EXPECT_TRUE(browser_proxy->IsFindWindowFullyVisible(&is_visible)); | |
118 return is_visible; | |
119 } | |
120 | |
121 bool PyUITestBase::OpenNewBrowserWindow(bool show) { | |
122 return automation()->OpenNewBrowserWindow(Browser::TYPE_TABBED, show); | |
123 } | |
124 | |
125 bool PyUITestBase::CloseBrowserWindow(int window_index) { | |
126 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | |
127 if (!browser_proxy.get()) | |
128 return false; | |
129 bool app_closed; | |
130 return CloseBrowser(browser_proxy.get(), &app_closed); | |
131 } | |
132 | |
133 int PyUITestBase::GetBrowserWindowCount() { | |
134 int num_windows = 0; | |
135 EXPECT_TRUE(automation()->GetBrowserWindowCount(&num_windows)); | |
136 return num_windows; | |
137 } | |
138 | |
139 bool PyUITestBase::GetBookmarkBarState(bool* visible, | 105 bool PyUITestBase::GetBookmarkBarState(bool* visible, |
140 bool* detached, | 106 bool* detached, |
141 int window_index) { | 107 int window_index) { |
142 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); | 108 scoped_refptr<BrowserProxy> browser_proxy = GetBrowserWindow(window_index); |
143 EXPECT_TRUE(browser_proxy.get()); | 109 EXPECT_TRUE(browser_proxy.get()); |
144 if (!browser_proxy.get()) | 110 if (!browser_proxy.get()) |
145 return false; | 111 return false; |
146 | 112 |
147 // We have no use for animating in this context. | 113 // We have no use for animating in this context. |
148 bool animating; | 114 bool animating; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 if (duration >= timeout) { | 288 if (duration >= timeout) { |
323 ErrorResponse( | 289 ErrorResponse( |
324 StringPrintf("Request timed out after %d seconds", | 290 StringPrintf("Request timed out after %d seconds", |
325 static_cast<int>(duration.InSeconds())), | 291 static_cast<int>(duration.InSeconds())), |
326 request, response); | 292 request, response); |
327 } else { | 293 } else { |
328 // TODO(craigdh): Determine specific cause. | 294 // TODO(craigdh): Determine specific cause. |
329 ErrorResponse("Chrome failed to respond", request, response); | 295 ErrorResponse("Chrome failed to respond", request, response); |
330 } | 296 } |
331 } | 297 } |
332 | |
333 bool PyUITestBase::ResetToDefaultTheme() { | |
334 return automation()->ResetToDefaultTheme(); | |
335 } | |
OLD | NEW |