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 "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 13 matching lines...) Expand all Loading... |
24 } | 24 } |
25 | 25 |
26 void AutomatedUITestBase::LogWarningMessage(const std::string& warning) { | 26 void AutomatedUITestBase::LogWarningMessage(const std::string& warning) { |
27 } | 27 } |
28 | 28 |
29 void AutomatedUITestBase::LogInfoMessage(const std::string& info) { | 29 void AutomatedUITestBase::LogInfoMessage(const std::string& info) { |
30 } | 30 } |
31 | 31 |
32 void AutomatedUITestBase::SetUp() { | 32 void AutomatedUITestBase::SetUp() { |
33 UITest::SetUp(); | 33 UITest::SetUp(); |
34 set_active_browser(automation()->GetBrowserWindow(0)); | 34 set_active_browser(automation()->GetBrowserWindow(0).get()); |
35 } | 35 } |
36 | 36 |
37 bool AutomatedUITestBase::BackButton() { | 37 bool AutomatedUITestBase::BackButton() { |
38 return RunCommand(IDC_BACK); | 38 return RunCommand(IDC_BACK); |
39 } | 39 } |
40 | 40 |
41 bool AutomatedUITestBase::CloseActiveTab() { | 41 bool AutomatedUITestBase::CloseActiveTab() { |
42 BrowserProxy* browser = active_browser(); | 42 BrowserProxy* browser = active_browser(); |
43 int tab_count; | 43 int tab_count; |
44 if (!browser->GetTabCount(&tab_count)) { | 44 if (!browser->GetTabCount(&tab_count)) { |
(...skipping 22 matching lines...) Expand all Loading... |
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 for (int i = 0; i < browser_windows_count - 1; ++i) { | 73 for (int i = 0; i < browser_windows_count - 1; ++i) { |
74 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(i)); | 74 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(i)); |
75 Browser::Type type; | 75 Browser::Type type; |
76 if (browser->GetType(&type) && type == Browser::TYPE_TABBED) { | 76 if (browser->GetType(&type) && type == Browser::TYPE_TABBED) { |
77 set_active_browser(browser); | 77 set_active_browser(browser.get()); |
78 return true; | 78 return true; |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 LogErrorMessage("Can't find browser window."); | 82 LogErrorMessage("Can't find browser window."); |
83 return false; | 83 return false; |
84 } | 84 } |
85 | 85 |
86 bool AutomatedUITestBase::DuplicateTab() { | 86 bool AutomatedUITestBase::DuplicateTab() { |
87 return RunCommand(IDC_DUPLICATE_TAB); | 87 return RunCommand(IDC_DUPLICATE_TAB); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 | 365 |
366 scoped_refptr<WindowProxy> AutomatedUITestBase::GetAndActivateWindowForBrowser( | 366 scoped_refptr<WindowProxy> AutomatedUITestBase::GetAndActivateWindowForBrowser( |
367 BrowserProxy* browser) { | 367 BrowserProxy* browser) { |
368 if (!browser->BringToFront()) { | 368 if (!browser->BringToFront()) { |
369 LogWarningMessage("failed_to_bring_window_to_front"); | 369 LogWarningMessage("failed_to_bring_window_to_front"); |
370 return NULL; | 370 return NULL; |
371 } | 371 } |
372 | 372 |
373 return browser->GetWindow(); | 373 return browser->GetWindow(); |
374 } | 374 } |
OLD | NEW |