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

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

Issue 196096: First part of automated_ui_tests improvements.... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: disable on lin/mac Created 11 years, 3 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
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/common/url_constants.h"
6 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h" 7 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h"
7 #include "chrome/test/automation/browser_proxy.h" 8 #include "chrome/test/automation/browser_proxy.h"
8 #include "chrome/test/automation/tab_proxy.h" 9 #include "chrome/test/automation/tab_proxy.h"
9 #include "chrome/test/ui/ui_test.h" 10 #include "chrome/test/ui/ui_test.h"
10 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
11 #include "net/base/net_util.h" 12 #include "net/base/net_util.h"
12 13
13 #if defined(OS_MACOSX) 14 #if defined(OS_MACOSX)
14 // The window pops up, but doesn't close. 15 // The window pops up, but doesn't close.
15 #define MAYBE_IncognitoWindow DISABLED_IncognitoWindow 16 #define MAYBE_IncognitoWindow DISABLED_IncognitoWindow
16 #define MAYBE_OpenCloseBrowserWindowWithAccelerator \ 17 #define MAYBE_OpenCloseBrowserWindowWithAccelerator \
17 DISABLED_OpenCloseBrowserWindowWithAccelerator 18 DISABLED_OpenCloseBrowserWindowWithAccelerator
18 #else 19 #else
19 // http://code.google.com/p/chromium/issues/detail?id=14731 20 // http://code.google.com/p/chromium/issues/detail?id=14731
20 #define MAYBE_IncognitoWindow DISABLED_IncognitoWindow 21 #define MAYBE_IncognitoWindow DISABLED_IncognitoWindow
21 // http://crbug.com/19394 22 // http://crbug.com/19394
22 #define MAYBE_OpenCloseBrowserWindowWithAccelerator \ 23 #define MAYBE_OpenCloseBrowserWindowWithAccelerator \
23 DISABLED_OpenCloseBrowserWindowWithAccelerator 24 DISABLED_OpenCloseBrowserWindowWithAccelerator
24 #endif 25 #endif
25 26
26 // http://code.google.com/p/chromium/issues/detail?id=14774 27 // http://code.google.com/p/chromium/issues/detail?id=14774
27 #if defined(OS_WIN) && !defined(NDEBUG) 28 #if defined(OS_WIN) && !defined(NDEBUG)
28 #define MAYBE_CloseTab DISABLED_CloseTab 29 #define MAYBE_CloseTab DISABLED_CloseTab
29 #define MAYBE_CloseBrowserWindow DISABLED_CloseBrowserWindow 30 #define MAYBE_CloseBrowserWindow DISABLED_CloseBrowserWindow
30 #else 31 #else
31 #define MAYBE_CloseTab CloseTab 32 #define MAYBE_CloseTab CloseTab
32 #define MAYBE_CloseBrowserWindow CloseBrowserWindow 33 #define MAYBE_CloseBrowserWindow CloseBrowserWindow
33 #endif 34 #endif
34 35
36 // Automation pieces are not implemented for these on platforms other than
37 // Windows.
38 #if defined(OS_WIN)
39 #define MAYBE_FindInPage FindInPage
40 #define MAYBE_ShowBookmarkBar ShowBookmarkBar
41 #else
42 #define MAYBE_FindInPage DISABLED_FindInPage
43 #define MAYBE_ShowBookmarkBar DISABLED_ShowBookmarkBar
44 #endif
45
46 TEST_F(AutomatedUITestBase, MAYBE_FindInPage) {
47 ASSERT_TRUE(FindInPage());
48 bool is_visible;
49 ASSERT_TRUE(active_browser()->IsFindWindowFullyVisible(&is_visible));
50 EXPECT_TRUE(is_visible);
51 }
52
53 TEST_F(AutomatedUITestBase, Home) {
54 FilePath path_prefix(test_data_directory_.AppendASCII("session_history"));
55 GURL bot1(net::FilePathToFileURL(path_prefix.AppendASCII("bot1.html")));
56 NavigateToURL(bot1); // To help verify that Home does something.
57
58 ASSERT_TRUE(Home());
59
60 GURL url;
61 ASSERT_TRUE(active_browser()->GetActiveTab()->GetCurrentURL(&url));
62 EXPECT_EQ(GURL(chrome::kAboutBlankURL), url);
63
64 std::wstring title;
65 ASSERT_TRUE(active_browser()->GetActiveTab()->GetTabTitle(&title));
66 EXPECT_EQ(L"", title);
67 }
68
35 TEST_F(AutomatedUITestBase, NewTab) { 69 TEST_F(AutomatedUITestBase, NewTab) {
36 int tab_count; 70 int tab_count;
37 active_browser()->GetTabCount(&tab_count); 71 active_browser()->GetTabCount(&tab_count);
38 ASSERT_EQ(1, tab_count); 72 ASSERT_EQ(1, tab_count);
39 NewTab(); 73 NewTab();
40 active_browser()->GetTabCount(&tab_count); 74 active_browser()->GetTabCount(&tab_count);
41 ASSERT_EQ(2, tab_count); 75 ASSERT_EQ(2, tab_count);
42 NewTab(); 76 NewTab();
43 active_browser()->GetTabCount(&tab_count); 77 active_browser()->GetTabCount(&tab_count);
44 ASSERT_EQ(3, tab_count); 78 ASSERT_EQ(3, tab_count);
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 ASSERT_TRUE(BackButton()); 321 ASSERT_TRUE(BackButton());
288 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 322 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
289 ASSERT_EQ(url1, url); 323 ASSERT_EQ(url1, url);
290 ASSERT_TRUE(ForwardButton()); 324 ASSERT_TRUE(ForwardButton());
291 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 325 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
292 ASSERT_EQ(url2, url); 326 ASSERT_EQ(url2, url);
293 ASSERT_TRUE(ReloadPage()); 327 ASSERT_TRUE(ReloadPage());
294 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 328 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
295 ASSERT_EQ(url2, url); 329 ASSERT_EQ(url2, url);
296 } 330 }
331
332 TEST_F(AutomatedUITestBase, SelectTab) {
333 FilePath filename(test_data_directory_);
334 filename = filename.AppendASCII("title2.html");
335 GURL url = net::FilePathToFileURL(filename);
336
337 ASSERT_TRUE(active_browser()->AppendTab(url));
338 ASSERT_TRUE(active_browser()->AppendTab(url));
339
340 int active_tab_index;
341 ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
342 ASSERT_EQ(2, active_tab_index);
343
344 ASSERT_TRUE(SelectNextTab());
345 ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
346 ASSERT_EQ(0, active_tab_index);
347
348 ASSERT_TRUE(SelectNextTab());
349 ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
350 ASSERT_EQ(1, active_tab_index);
351
352 ASSERT_TRUE(SelectPreviousTab());
353 ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
354 ASSERT_EQ(0, active_tab_index);
355
356 ASSERT_TRUE(SelectPreviousTab());
357 ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
358 ASSERT_EQ(2, active_tab_index);
359
360 ASSERT_TRUE(SelectPreviousTab());
361 ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
362 ASSERT_EQ(1, active_tab_index);
363
364 ASSERT_TRUE(SelectNextTab());
365 ASSERT_TRUE(active_browser()->GetActiveTabIndex(&active_tab_index));
366 ASSERT_EQ(2, active_tab_index);
367 }
368
369 TEST_F(AutomatedUITestBase, MAYBE_ShowBookmarkBar) {
370 ASSERT_TRUE(ShowBookmarkBar());
371 bool is_visible;
372 bool is_animating;
373 ASSERT_TRUE(active_browser()->GetBookmarkBarVisibility(&is_visible,
374 &is_animating));
375 ASSERT_TRUE(is_visible);
376 ASSERT_FALSE(is_animating);
377
378 // Try second time to make sure it won't make the bookmark bar
379 // disappear.
380 ASSERT_TRUE(ShowBookmarkBar());
381 ASSERT_TRUE(active_browser()->GetBookmarkBarVisibility(&is_visible,
382 &is_animating));
383 ASSERT_TRUE(is_visible);
384 ASSERT_FALSE(is_animating);
385 }
386
387 TEST_F(AutomatedUITestBase, ShowDownloads) {
388 ASSERT_TRUE(ShowDownloads());
389 GURL url;
390 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
391 ASSERT_EQ(GURL(chrome::kChromeUIDownloadsURL), url);
392 }
393
394 TEST_F(AutomatedUITestBase, ShowHistory) {
395 ASSERT_TRUE(ShowHistory());
396 GURL url;
397 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
398 ASSERT_EQ(GURL(chrome::kChromeUIHistoryURL), url);
399 }
OLDNEW
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_test_base.cc ('k') | chrome/test/automated_ui_tests/automated_ui_tests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698