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

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

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

Powered by Google App Engine
This is Rietveld 408576698