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

Side by Side Diff: chrome/browser/ui/webui/bookmarks_ui_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_tabstrip.h"
9 #include "chrome/browser/ui/chrome_pages.h" 10 #include "chrome/browser/ui/chrome_pages.h"
10 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
11 #include "chrome/test/base/in_process_browser_test.h" 12 #include "chrome/test/base/in_process_browser_test.h"
12 #include "chrome/test/base/ui_test_utils.h" 13 #include "chrome/test/base/ui_test_utils.h"
13 #include "content/public/browser/notification_service.h" 14 #include "content/public/browser/notification_service.h"
14 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
15 #include "content/public/test/test_navigation_observer.h" 16 #include "content/public/test/test_navigation_observer.h"
16 17
17 class BookmarksTest : public InProcessBrowserTest { 18 class BookmarksTest : public InProcessBrowserTest {
18 public: 19 public:
(...skipping 19 matching lines...) Expand all
38 ASSERT_EQ("chrome-extension:", out); 39 ASSERT_EQ("chrome-extension:", out);
39 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( 40 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString(
40 tab->GetRenderViewHost(), L"", 41 tab->GetRenderViewHost(), L"",
41 L"domAutomationController.send(location.pathname)", &out)); 42 L"domAutomationController.send(location.pathname)", &out));
42 ASSERT_EQ("/main.html", out); 43 ASSERT_EQ("/main.html", out);
43 } 44 }
44 }; 45 };
45 46
46 IN_PROC_BROWSER_TEST_F(BookmarksTest, ShouldRedirectToExtension) { 47 IN_PROC_BROWSER_TEST_F(BookmarksTest, ShouldRedirectToExtension) {
47 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL)); 48 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL));
48 AssertIsBookmarksPage(browser()->GetActiveWebContents()); 49 AssertIsBookmarksPage(chrome::GetActiveWebContents(browser()));
49 } 50 }
50 51
51 IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandOpensBookmarksTab) { 52 IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandOpensBookmarksTab) {
52 ASSERT_EQ(1, browser()->tab_count()); 53 ASSERT_EQ(1, browser()->tab_count());
53 54
54 // Bring up the bookmarks manager tab. 55 // Bring up the bookmarks manager tab.
55 OpenBookmarksManager(); 56 OpenBookmarksManager();
56 ASSERT_EQ(1, browser()->tab_count()); 57 ASSERT_EQ(1, browser()->tab_count());
57 AssertIsBookmarksPage(browser()->GetActiveWebContents()); 58 AssertIsBookmarksPage(chrome::GetActiveWebContents(browser()));
58 } 59 }
59 60
60 // If this flakes on Mac, use: http://crbug.com/87200 61 // If this flakes on Mac, use: http://crbug.com/87200
61 IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandAgainGoesBackToBookmarksTab) { 62 IN_PROC_BROWSER_TEST_F(BookmarksTest, CommandAgainGoesBackToBookmarksTab) {
62 ui_test_utils::NavigateToURL( 63 ui_test_utils::NavigateToURL(
63 browser(), 64 browser(),
64 ui_test_utils::GetTestUrl(FilePath(), 65 ui_test_utils::GetTestUrl(FilePath(),
65 FilePath().AppendASCII("simple.html"))); 66 FilePath().AppendASCII("simple.html")));
66 ASSERT_EQ(1, browser()->tab_count()); 67 ASSERT_EQ(1, browser()->tab_count());
67 68
68 // Bring up the bookmarks manager tab. 69 // Bring up the bookmarks manager tab.
69 OpenBookmarksManager(); 70 OpenBookmarksManager();
70 ASSERT_EQ(2, browser()->tab_count()); 71 ASSERT_EQ(2, browser()->tab_count());
71 72
72 AssertIsBookmarksPage(browser()->GetActiveWebContents()); 73 AssertIsBookmarksPage(chrome::GetActiveWebContents(browser()));
73 74
74 // Switch to first tab and run command again. 75 // Switch to first tab and run command again.
75 browser()->ActivateTabAt(0, true); 76 chrome::ActivateTabAt(browser(), 0, true);
76 chrome::ShowBookmarkManager(browser()); 77 chrome::ShowBookmarkManager(browser());
77 78
78 // Ensure the bookmarks ui tab is active. 79 // Ensure the bookmarks ui tab is active.
79 ASSERT_EQ(1, browser()->active_index()); 80 ASSERT_EQ(1, browser()->active_index());
80 ASSERT_EQ(2, browser()->tab_count()); 81 ASSERT_EQ(2, browser()->tab_count());
81 } 82 }
82 83
83 IN_PROC_BROWSER_TEST_F(BookmarksTest, TwoCommandsOneTab) { 84 IN_PROC_BROWSER_TEST_F(BookmarksTest, TwoCommandsOneTab) {
84 content::TestNavigationObserver navigation_observer( 85 content::TestNavigationObserver navigation_observer(
85 content::NotificationService::AllSources()); 86 content::NotificationService::AllSources());
86 chrome::ShowBookmarkManager(browser()); 87 chrome::ShowBookmarkManager(browser());
87 chrome::ShowBookmarkManager(browser()); 88 chrome::ShowBookmarkManager(browser());
88 navigation_observer.Wait(); 89 navigation_observer.Wait();
89 90
90 ASSERT_EQ(1, browser()->tab_count()); 91 ASSERT_EQ(1, browser()->tab_count());
91 } 92 }
92 93
93 IN_PROC_BROWSER_TEST_F(BookmarksTest, BookmarksLoaded) { 94 IN_PROC_BROWSER_TEST_F(BookmarksTest, BookmarksLoaded) {
94 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL)); 95 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL));
95 ASSERT_EQ(1, browser()->tab_count()); 96 ASSERT_EQ(1, browser()->tab_count());
96 AssertIsBookmarksPage(browser()->GetActiveWebContents()); 97 AssertIsBookmarksPage(chrome::GetActiveWebContents(browser()));
97 } 98 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/wrench_menu.cc ('k') | chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698