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/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.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/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 TEST_F(BookmarksUITest, CommandAgainGoesBackToBookmarksTab) { | 104 TEST_F(BookmarksUITest, CommandAgainGoesBackToBookmarksTab) { |
105 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 105 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
106 ASSERT_TRUE(browser.get()); | 106 ASSERT_TRUE(browser.get()); |
107 | 107 |
108 int tab_count = -1; | 108 int tab_count = -1; |
109 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 109 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
110 ASSERT_EQ(1, tab_count); | 110 ASSERT_EQ(1, tab_count); |
111 | 111 |
112 // Bring up the bookmarks manager tab. | 112 // Bring up the bookmarks manager tab. |
113 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 113 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
114 ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); | 114 ASSERT_TRUE(browser->WaitForTabToBecomeActive( |
| 115 1, TestTimeouts::action_max_timeout_ms())); |
115 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 116 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
116 ASSERT_EQ(2, tab_count); | 117 ASSERT_EQ(2, tab_count); |
117 | 118 |
118 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 119 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
119 ASSERT_TRUE(tab.get()); | 120 ASSERT_TRUE(tab.get()); |
120 ASSERT_TRUE(WaitForBookmarksUI(tab)); | 121 ASSERT_TRUE(WaitForBookmarksUI(tab)); |
121 AssertIsBookmarksPage(tab); | 122 AssertIsBookmarksPage(tab); |
122 | 123 |
123 // Switch to first tab and run command again. | 124 // Switch to first tab and run command again. |
124 ASSERT_TRUE(browser->ActivateTab(0)); | 125 ASSERT_TRUE(browser->ActivateTab(0)); |
125 ASSERT_TRUE(browser->WaitForTabToBecomeActive(0, action_max_timeout_ms())); | 126 ASSERT_TRUE(browser->WaitForTabToBecomeActive( |
| 127 0, TestTimeouts::action_max_timeout_ms())); |
126 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 128 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
127 | 129 |
128 // Ensure the bookmarks ui tab is active. | 130 // Ensure the bookmarks ui tab is active. |
129 ASSERT_TRUE(browser->WaitForTabToBecomeActive(1, action_max_timeout_ms())); | 131 ASSERT_TRUE(browser->WaitForTabToBecomeActive( |
| 132 1, TestTimeouts::action_max_timeout_ms())); |
130 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 133 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
131 ASSERT_EQ(2, tab_count); | 134 ASSERT_EQ(2, tab_count); |
132 } | 135 } |
133 | 136 |
134 TEST_F(BookmarksUITest, TwoCommandsOneTab) { | 137 TEST_F(BookmarksUITest, TwoCommandsOneTab) { |
135 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 138 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
136 ASSERT_TRUE(browser.get()); | 139 ASSERT_TRUE(browser.get()); |
137 | 140 |
138 int tab_count = -1; | 141 int tab_count = -1; |
139 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 142 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
140 ASSERT_EQ(1, tab_count); | 143 ASSERT_EQ(1, tab_count); |
141 | 144 |
142 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 145 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
143 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); | 146 ASSERT_TRUE(browser->RunCommand(IDC_SHOW_BOOKMARK_MANAGER)); |
144 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 147 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
145 ASSERT_EQ(2, tab_count); | 148 ASSERT_EQ(2, tab_count); |
146 } | 149 } |
147 | 150 |
148 TEST_F(BookmarksUITest, BookmarksLoaded) { | 151 TEST_F(BookmarksUITest, BookmarksLoaded) { |
149 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); | 152 scoped_refptr<TabProxy> tab = GetBookmarksUITab(); |
150 ASSERT_TRUE(tab.get()); | 153 ASSERT_TRUE(tab.get()); |
151 } | 154 } |
OLD | NEW |