Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/test/automated_ui_tests/automated_ui_test_test.cc

Issue 125142: Move automated_ui_test_test to ui_tests from a library so it actually gets ru... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_test_base.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/app/chrome_dll_resource.h" 5 #include "chrome/app/chrome_dll_resource.h"
6 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" 6 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h"
7 #include "chrome/test/automation/browser_proxy.h" 7 #include "chrome/test/automation/browser_proxy.h"
8 #include "chrome/test/automation/tab_proxy.h" 8 #include "chrome/test/automation/tab_proxy.h"
9 #include "chrome/test/ui/ui_test.h" 9 #include "chrome/test/ui/ui_test.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
11 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
12 12
13 #if defined(OS_MACOSX)
14 // The window pops up, but doesn't close.
15 #define MAYBE_IncognitoWindow DISABLED_IncognitoWindow
16 #define MAYBE_OpenCloseBrowserWindowWithAccelerator \
17 DISABLED_OpenCloseBrowserWindowWithAccelerator
18 #else
19 #define MAYBE_IncognitoWindow IncognitoWindow
20 #define MAYBE_OpenCloseBrowserWindowWithAccelerator \
21 OpenCloseBrowserWindowWithAccelerator
22 #endif
23
13 TEST_F(AutomatedUITestBase, NewTab) { 24 TEST_F(AutomatedUITestBase, NewTab) {
14 int tab_count; 25 int tab_count;
15 active_browser()->GetTabCount(&tab_count); 26 active_browser()->GetTabCount(&tab_count);
16 ASSERT_EQ(1, tab_count); 27 ASSERT_EQ(1, tab_count);
17 NewTab(); 28 NewTab();
18 active_browser()->GetTabCount(&tab_count); 29 active_browser()->GetTabCount(&tab_count);
19 ASSERT_EQ(2, tab_count); 30 ASSERT_EQ(2, tab_count);
20 NewTab(); 31 NewTab();
21 active_browser()->GetTabCount(&tab_count); 32 active_browser()->GetTabCount(&tab_count);
22 ASSERT_EQ(3, tab_count); 33 ASSERT_EQ(3, tab_count);
23 } 34 }
24 35
25 TEST_F(AutomatedUITestBase, DuplicateTab) { 36 TEST_F(AutomatedUITestBase, DuplicateTab) {
26 int tab_count; 37 int tab_count;
27 active_browser()->GetTabCount(&tab_count); 38 active_browser()->GetTabCount(&tab_count);
28 ASSERT_EQ(1, tab_count); 39 ASSERT_EQ(1, tab_count);
29 DuplicateTab(); 40 DuplicateTab();
30 active_browser()->GetTabCount(&tab_count); 41 active_browser()->GetTabCount(&tab_count);
31 ASSERT_EQ(2, tab_count); 42 ASSERT_EQ(2, tab_count);
32 DuplicateTab(); 43 DuplicateTab();
33 active_browser()->GetTabCount(&tab_count); 44 active_browser()->GetTabCount(&tab_count);
34 ASSERT_EQ(3, tab_count); 45 ASSERT_EQ(3, tab_count);
35 } 46 }
36 47
37 TEST_F(AutomatedUITestBase, RestoreTab) { 48 TEST_F(AutomatedUITestBase, DISABLED_RestoreTab) {
38 int tab_count; 49 int tab_count;
39 active_browser()->GetTabCount(&tab_count); 50 active_browser()->GetTabCount(&tab_count);
40 ASSERT_EQ(1, tab_count); 51 ASSERT_EQ(1, tab_count);
41 NewTab(); 52 NewTab();
42 active_browser()->GetTabCount(&tab_count); 53 active_browser()->GetTabCount(&tab_count);
43 ASSERT_EQ(2, tab_count); 54 ASSERT_EQ(2, tab_count);
44 FilePath path_prefix(test_data_directory_.AppendASCII("session_history")); 55 FilePath path_prefix(test_data_directory_.AppendASCII("session_history"));
45 GURL test_url = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")); 56 GURL test_url = net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html"));
46 GetActiveTab()->NavigateToURL(test_url); 57 GetActiveTab()->NavigateToURL(test_url);
47 CloseActiveTab(); 58 CloseActiveTab();
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } else { 182 } else {
172 ASSERT_EQ(3, tab_count); 183 ASSERT_EQ(3, tab_count);
173 ASSERT_TRUE(CloseActiveWindow()); 184 ASSERT_TRUE(CloseActiveWindow());
174 active_browser()->GetTabCount(&tab_count); 185 active_browser()->GetTabCount(&tab_count);
175 ASSERT_EQ(2, tab_count); 186 ASSERT_EQ(2, tab_count);
176 } 187 }
177 188
178 ASSERT_FALSE(CloseActiveWindow()); 189 ASSERT_FALSE(CloseActiveWindow());
179 } 190 }
180 191
181 TEST_F(AutomatedUITestBase, IncognitoWindow) { 192 TEST_F(AutomatedUITestBase, MAYBE_IncognitoWindow) {
182 int num_browser_windows; 193 int num_browser_windows;
183 int num_normal_browser_windows; 194 int num_normal_browser_windows;
184 automation()->GetBrowserWindowCount(&num_browser_windows); 195 automation()->GetBrowserWindowCount(&num_browser_windows);
185 ASSERT_EQ(1, num_browser_windows); 196 ASSERT_EQ(1, num_browser_windows);
186 automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows); 197 automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows);
187 ASSERT_EQ(1, num_normal_browser_windows); 198 ASSERT_EQ(1, num_normal_browser_windows);
188 199
189 ASSERT_TRUE(GoOffTheRecord()); 200 ASSERT_TRUE(GoOffTheRecord());
190 ASSERT_TRUE(GoOffTheRecord()); 201 ASSERT_TRUE(GoOffTheRecord());
191 automation()->GetBrowserWindowCount(&num_browser_windows); 202 automation()->GetBrowserWindowCount(&num_browser_windows);
192 ASSERT_EQ(3, num_browser_windows); 203 ASSERT_EQ(3, num_browser_windows);
193 automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows); 204 automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows);
194 ASSERT_EQ(1, num_normal_browser_windows); 205 ASSERT_EQ(1, num_normal_browser_windows);
195 206
196 // There is only one normal window so it will not be closed. 207 // There is only one normal window so it will not be closed.
197 ASSERT_FALSE(CloseActiveWindow()); 208 ASSERT_FALSE(CloseActiveWindow());
198 automation()->GetBrowserWindowCount(&num_browser_windows); 209 automation()->GetBrowserWindowCount(&num_browser_windows);
199 ASSERT_EQ(3, num_browser_windows); 210 ASSERT_EQ(3, num_browser_windows);
200 automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows); 211 automation()->GetNormalBrowserWindowCount(&num_normal_browser_windows);
201 ASSERT_EQ(1, num_normal_browser_windows); 212 ASSERT_EQ(1, num_normal_browser_windows);
202 213
203 set_active_browser(automation()->GetBrowserWindow(0)); 214 set_active_browser(automation()->GetBrowserWindow(0));
204 ASSERT_TRUE(RunCommand(IDC_CLOSE_WINDOW)); 215 ASSERT_TRUE(RunCommand(IDC_CLOSE_WINDOW));
205 set_active_browser(automation()->GetBrowserWindow(0)); 216 set_active_browser(automation()->GetBrowserWindow(0));
206 ASSERT_TRUE(RunCommand(IDC_CLOSE_WINDOW)); 217 ASSERT_TRUE(RunCommand(IDC_CLOSE_WINDOW));
207 automation()->GetBrowserWindowCount(&num_browser_windows); 218 automation()->GetBrowserWindowCount(&num_browser_windows);
208 ASSERT_EQ(1, num_browser_windows); 219 ASSERT_EQ(1, num_browser_windows);
209 } 220 }
210 221
211 TEST_F(AutomatedUITestBase, OpenCloseBrowserWindowWithAccelerator) { 222 TEST_F(AutomatedUITestBase, MAYBE_OpenCloseBrowserWindowWithAccelerator) {
212 // Note: we don't use RunCommand(IDC_OPEN/CLOSE_WINDOW) to open/close 223 // Note: we don't use RunCommand(IDC_OPEN/CLOSE_WINDOW) to open/close
213 // browser window in automated ui tests. Instead we use 224 // browser window in automated ui tests. Instead we use
214 // OpenAndActivateNewBrowserWindow and CloseActiveWindow. 225 // OpenAndActivateNewBrowserWindow and CloseActiveWindow.
215 // There are other parts of UI test that use the accelerators. This is 226 // There are other parts of UI test that use the accelerators. This is
216 // a unit test for those usage. 227 // a unit test for those usage.
217 ASSERT_TRUE(RunCommand(IDC_NEW_WINDOW)); 228 ASSERT_TRUE(RunCommand(IDC_NEW_WINDOW));
218 int num_browser_windows; 229 int num_browser_windows;
219 automation()->GetBrowserWindowCount(&num_browser_windows); 230 automation()->GetBrowserWindowCount(&num_browser_windows);
220 ASSERT_EQ(2, num_browser_windows); 231 ASSERT_EQ(2, num_browser_windows);
221 ASSERT_TRUE(RunCommand(IDC_NEW_WINDOW)); 232 ASSERT_TRUE(RunCommand(IDC_NEW_WINDOW));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 ASSERT_TRUE(BackButton()); 276 ASSERT_TRUE(BackButton());
266 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 277 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
267 ASSERT_EQ(url1, url); 278 ASSERT_EQ(url1, url);
268 ASSERT_TRUE(ForwardButton()); 279 ASSERT_TRUE(ForwardButton());
269 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 280 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
270 ASSERT_EQ(url2, url); 281 ASSERT_EQ(url2, url);
271 ASSERT_TRUE(ReloadPage()); 282 ASSERT_TRUE(ReloadPage());
272 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 283 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
273 ASSERT_EQ(url2, url); 284 ASSERT_EQ(url2, url);
274 } 285 }
OLDNEW
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_test_base.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698