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 "chrome/test/reliability/automated_ui_test_base.h" | 5 #include "chrome/test/reliability/automated_ui_test_base.h" |
6 | 6 |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/ui/view_ids.h" | 9 #include "chrome/browser/ui/view_ids.h" |
10 #include "chrome/test/automation/automation_proxy.h" | 10 #include "chrome/test/automation/automation_proxy.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return false; | 63 return false; |
64 // Avoid quitting the application by not closing the last window. | 64 // Avoid quitting the application by not closing the last window. |
65 if (browser_windows_count < 2) | 65 if (browser_windows_count < 2) |
66 return false; | 66 return false; |
67 bool application_closed; | 67 bool application_closed; |
68 CloseBrowser(active_browser(), &application_closed); | 68 CloseBrowser(active_browser(), &application_closed); |
69 if (application_closed) { | 69 if (application_closed) { |
70 LogErrorMessage("Application closed unexpectedly."); | 70 LogErrorMessage("Application closed unexpectedly."); |
71 return false; | 71 return false; |
72 } | 72 } |
73 scoped_refptr<BrowserProxy> browser(automation()->FindTabbedBrowserWindow()); | 73 for (int i = 0; i < browser_windows_count - 1; ++i) { |
74 if (!browser.get()) { | 74 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(i)); |
75 LogErrorMessage("Can't find browser window."); | 75 Browser::Type type; |
76 return false; | 76 if (browser->GetType(&type) && type == Browser::TYPE_TABBED) { |
| 77 set_active_browser(browser); |
| 78 return true; |
| 79 } |
77 } | 80 } |
78 set_active_browser(browser); | 81 |
79 return true; | 82 LogErrorMessage("Can't find browser window."); |
| 83 return false; |
80 } | 84 } |
81 | 85 |
82 bool AutomatedUITestBase::DuplicateTab() { | 86 bool AutomatedUITestBase::DuplicateTab() { |
83 return RunCommand(IDC_DUPLICATE_TAB); | 87 return RunCommand(IDC_DUPLICATE_TAB); |
84 } | 88 } |
85 | 89 |
86 bool AutomatedUITestBase::DragTabOut() { | 90 bool AutomatedUITestBase::DragTabOut() { |
87 BrowserProxy* browser = active_browser(); | 91 BrowserProxy* browser = active_browser(); |
88 if (browser == NULL) { | 92 if (browser == NULL) { |
89 LogErrorMessage("browser_window_not_found"); | 93 LogErrorMessage("browser_window_not_found"); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 386 |
383 scoped_refptr<WindowProxy> AutomatedUITestBase::GetAndActivateWindowForBrowser( | 387 scoped_refptr<WindowProxy> AutomatedUITestBase::GetAndActivateWindowForBrowser( |
384 BrowserProxy* browser) { | 388 BrowserProxy* browser) { |
385 if (!browser->BringToFront()) { | 389 if (!browser->BringToFront()) { |
386 LogWarningMessage("failed_to_bring_window_to_front"); | 390 LogWarningMessage("failed_to_bring_window_to_front"); |
387 return NULL; | 391 return NULL; |
388 } | 392 } |
389 | 393 |
390 return browser->GetWindow(); | 394 return browser->GetWindow(); |
391 } | 395 } |
OLD | NEW |