OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/app/chrome_dll_resource.h" | 5 #include "chrome/app/chrome_dll_resource.h" |
6 #include "chrome/browser/view_ids.h" | 6 #include "chrome/browser/view_ids.h" |
7 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" | 7 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" |
8 #include "chrome/test/automation/browser_proxy.h" | 8 #include "chrome/test/automation/browser_proxy.h" |
9 #include "chrome/test/automation/tab_proxy.h" | 9 #include "chrome/test/automation/tab_proxy.h" |
10 #include "chrome/test/automation/window_proxy.h" | 10 #include "chrome/test/automation/window_proxy.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 return RunCommand(IDC_NEW_INCOGNITO_WINDOW); | 246 return RunCommand(IDC_NEW_INCOGNITO_WINDOW); |
247 } | 247 } |
248 | 248 |
249 bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow( | 249 bool AutomatedUITestBase::OpenAndActivateNewBrowserWindow( |
250 scoped_refptr<BrowserProxy>* previous_browser) { | 250 scoped_refptr<BrowserProxy>* previous_browser) { |
251 if (!automation()->OpenNewBrowserWindow(true /* SW_SHOWNORMAL */)) { | 251 if (!automation()->OpenNewBrowserWindow(true /* SW_SHOWNORMAL */)) { |
252 LogWarningMessage("failed_to_open_new_browser_window"); | 252 LogWarningMessage("failed_to_open_new_browser_window"); |
253 return false; | 253 return false; |
254 } | 254 } |
255 int num_browser_windows; | 255 int num_browser_windows; |
256 automation()->GetBrowserWindowCount(&num_browser_windows); | 256 if (!automation()->GetBrowserWindowCount(&num_browser_windows)) { |
| 257 LogErrorMessage("failed_to_get_browser_window_count"); |
| 258 return false; |
| 259 } |
257 // Get the most recently opened browser window and activate the tab | 260 // Get the most recently opened browser window and activate the tab |
258 // in order to activate this browser window. | 261 // in order to activate this browser window. |
259 scoped_refptr<BrowserProxy> browser( | 262 scoped_refptr<BrowserProxy> browser( |
260 automation()->GetBrowserWindow(num_browser_windows - 1)); | 263 automation()->GetBrowserWindow(num_browser_windows - 1)); |
261 if (browser.get() == NULL) { | 264 if (browser.get() == NULL) { |
262 LogErrorMessage("browser_window_not_found"); | 265 LogErrorMessage("browser_window_not_found"); |
263 return false; | 266 return false; |
264 } | 267 } |
265 bool is_timeout; | 268 bool is_timeout; |
266 if (!browser->ActivateTabWithTimeout(0, action_max_timeout_ms(), | 269 if (!browser->ActivateTabWithTimeout(0, action_max_timeout_ms(), |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 BrowserProxy* browser) { | 360 BrowserProxy* browser) { |
358 bool did_timeout; | 361 bool did_timeout; |
359 if (!browser->BringToFrontWithTimeout(action_max_timeout_ms(), | 362 if (!browser->BringToFrontWithTimeout(action_max_timeout_ms(), |
360 &did_timeout)) { | 363 &did_timeout)) { |
361 LogWarningMessage("failed_to_bring_window_to_front"); | 364 LogWarningMessage("failed_to_bring_window_to_front"); |
362 return NULL; | 365 return NULL; |
363 } | 366 } |
364 | 367 |
365 return browser->GetWindow(); | 368 return browser->GetWindow(); |
366 } | 369 } |
OLD | NEW |