OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/app/chrome_dll_resource.h" | 9 #include "chrome/app/chrome_dll_resource.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 59 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
60 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 60 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
61 ASSERT_EQ(2, tab_count); | 61 ASSERT_EQ(2, tab_count); |
62 | 62 |
63 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 63 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
64 ASSERT_TRUE(tab.get()); | 64 ASSERT_TRUE(tab.get()); |
65 AssertIsOptionsPage(tab); | 65 AssertIsOptionsPage(tab); |
66 } | 66 } |
67 | 67 |
68 // TODO(csilv): Investigate why this fails and fix. http://crbug.com/48521 | 68 // TODO(csilv): Investigate why this fails and fix. http://crbug.com/48521 |
69 TEST_F(OptionsUITest, FLAKY_CommandAgainGoesBackToOptionsTab) { | 69 // Also, crashing on linux/views. |
| 70 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) |
| 71 #define MAYBE_CommandAgainGoesBackToOptionsTab \ |
| 72 DISABLED_CommandAgainGoesBackToOptionsTab |
| 73 #else |
| 74 #define MAYBE_CommandAgainGoesBackToOptionsTab \ |
| 75 FLAKY_CommandAgainGoesBackToOptionsTab |
| 76 #endif |
| 77 |
| 78 TEST_F(OptionsUITest, MAYBE_CommandAgainGoesBackToOptionsTab) { |
70 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 79 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
71 ASSERT_TRUE(browser.get()); | 80 ASSERT_TRUE(browser.get()); |
72 | 81 |
73 int tab_count = -1; | 82 int tab_count = -1; |
74 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 83 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
75 ASSERT_EQ(1, tab_count); | 84 ASSERT_EQ(1, tab_count); |
76 | 85 |
77 // Bring up the options tab via command. | 86 // Bring up the options tab via command. |
78 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 87 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
79 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 88 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
80 ASSERT_EQ(2, tab_count); | 89 ASSERT_EQ(2, tab_count); |
81 | 90 |
82 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 91 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
83 ASSERT_TRUE(tab.get()); | 92 ASSERT_TRUE(tab.get()); |
84 AssertIsOptionsPage(tab); | 93 AssertIsOptionsPage(tab); |
85 | 94 |
86 // Switch to first tab and run command again. | 95 // Switch to first tab and run command again. |
87 ASSERT_TRUE(browser->ActivateTab(0)); | 96 ASSERT_TRUE(browser->ActivateTab(0)); |
88 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); | 97 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); |
89 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 98 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
90 | 99 |
91 // Ensure the options ui tab is active. | 100 // Ensure the options ui tab is active. |
92 ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); | 101 ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); |
93 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 102 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
94 ASSERT_EQ(2, tab_count); | 103 ASSERT_EQ(2, tab_count); |
95 } | 104 } |
96 | 105 |
97 // TODO(csilv): Investigate why this fails (sometimes) on 10.5 and fix. | 106 // TODO(csilv): Investigate why this fails (sometimes) on 10.5 and fix. |
98 // http://crbug.com/48521 | 107 // http://crbug.com/48521. Also, crashing on linux/views. |
99 TEST_F(OptionsUITest, FLAKY_TwoCommandsOneTab) { | 108 #if defined(OS_LINUX) && defined(TOOLKIT_VIEWS) |
| 109 #define MAYBE_TwoCommandsOneTab DISABLED_TwoCommandsOneTab |
| 110 #else |
| 111 #define MAYBE_TwoComamndsOneTab FLAKY_TwoCommandsOneTab |
| 112 #endif |
| 113 |
| 114 TEST_F(OptionsUITest, MAYBE_TwoCommandsOneTab) { |
100 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 115 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
101 ASSERT_TRUE(browser.get()); | 116 ASSERT_TRUE(browser.get()); |
102 | 117 |
103 int tab_count = -1; | 118 int tab_count = -1; |
104 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 119 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
105 ASSERT_EQ(1, tab_count); | 120 ASSERT_EQ(1, tab_count); |
106 | 121 |
107 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 122 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
108 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); | 123 ASSERT_TRUE(browser->RunCommand(IDC_OPTIONS)); |
109 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 124 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
110 ASSERT_EQ(2, tab_count); | 125 ASSERT_EQ(2, tab_count); |
111 } | 126 } |
112 | 127 |
113 } // namespace | 128 } // namespace |
OLD | NEW |