| OLD | NEW |
| 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/string16.h" | 7 #include "base/string16.h" |
| 8 #include "base/test/test_timeouts.h" |
| 8 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
| 11 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/test/automation/browser_proxy.h" | 13 #include "chrome/test/automation/browser_proxy.h" |
| 13 #include "chrome/test/automation/tab_proxy.h" | 14 #include "chrome/test/automation/tab_proxy.h" |
| 14 #include "chrome/test/automation/window_proxy.h" | 15 #include "chrome/test/automation/window_proxy.h" |
| 15 #include "chrome/test/ui/ui_test.h" | 16 #include "chrome/test/ui/ui_test.h" |
| 16 | 17 |
| 17 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 86 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
| 86 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 87 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 87 ASSERT_EQ(2, tab_count); | 88 ASSERT_EQ(2, tab_count); |
| 88 | 89 |
| 89 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 90 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| 90 ASSERT_TRUE(tab.get()); | 91 ASSERT_TRUE(tab.get()); |
| 91 AssertIsOptionsPage(tab); | 92 AssertIsOptionsPage(tab); |
| 92 | 93 |
| 93 // Switch to first tab and run command again. | 94 // Switch to first tab and run command again. |
| 94 ASSERT_TRUE(browser->ActivateTab(0)); | 95 ASSERT_TRUE(browser->ActivateTab(0)); |
| 95 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); | 96 ASSERT_TRUE(browser->WaitForTabToBecomeActive( |
| 97 0, TestTimeouts::action_max_timeout_ms())); |
| 96 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 98 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
| 97 | 99 |
| 98 // Ensure the options ui tab is active. | 100 // Ensure the options ui tab is active. |
| 99 ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); | 101 ASSERT_TRUE(browser->WaitForTabToBecomeActive( |
| 102 1, TestTimeouts::action_max_timeout_ms())); |
| 100 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 103 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 101 ASSERT_EQ(2, tab_count); | 104 ASSERT_EQ(2, tab_count); |
| 102 } | 105 } |
| 103 | 106 |
| 104 // TODO(csilv): Investigate why this fails (sometimes) on 10.5 and fix. | 107 // TODO(csilv): Investigate why this fails (sometimes) on 10.5 and fix. |
| 105 // http://crbug.com/48521. Also, crashing on linux/views. | 108 // http://crbug.com/48521. Also, crashing on linux/views. |
| 106 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) | 109 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) |
| 107 #define MAYBE_TwoCommandsOneTab DISABLED_TwoCommandsOneTab | 110 #define MAYBE_TwoCommandsOneTab DISABLED_TwoCommandsOneTab |
| 108 #else | 111 #else |
| 109 #define MAYBE_TwoCommandsOneTab FLAKY_TwoCommandsOneTab | 112 #define MAYBE_TwoCommandsOneTab FLAKY_TwoCommandsOneTab |
| 110 #endif | 113 #endif |
| 111 | 114 |
| 112 TEST_F(OptionsUITest, MAYBE_TwoCommandsOneTab) { | 115 TEST_F(OptionsUITest, MAYBE_TwoCommandsOneTab) { |
| 113 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 116 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 114 ASSERT_TRUE(browser.get()); | 117 ASSERT_TRUE(browser.get()); |
| 115 | 118 |
| 116 int tab_count = -1; | 119 int tab_count = -1; |
| 117 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 120 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 118 ASSERT_EQ(1, tab_count); | 121 ASSERT_EQ(1, tab_count); |
| 119 | 122 |
| 120 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 123 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
| 121 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 124 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
| 122 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 125 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 123 ASSERT_EQ(2, tab_count); | 126 ASSERT_EQ(2, tab_count); |
| 124 } | 127 } |
| 125 | 128 |
| 126 } // namespace | 129 } // namespace |
| OLD | NEW |