OLD | NEW |
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/chrome_pages.h" | 9 #include "chrome/browser/ui/chrome_pages.h" |
10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 content::NotificationService::AllSources(), NULL, 2); | 25 content::NotificationService::AllSources(), NULL, 2); |
26 | 26 |
27 // Bring up the bookmarks manager tab. | 27 // Bring up the bookmarks manager tab. |
28 chrome::ShowBookmarkManager(browser()); | 28 chrome::ShowBookmarkManager(browser()); |
29 navigation_observer.Wait(); | 29 navigation_observer.Wait(); |
30 } | 30 } |
31 | 31 |
32 void AssertIsBookmarksPage(content::WebContents* tab) { | 32 void AssertIsBookmarksPage(content::WebContents* tab) { |
33 GURL url; | 33 GURL url; |
34 std::string out; | 34 std::string out; |
35 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( | 35 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
36 tab->GetRenderViewHost(), | 36 tab, |
37 "", | |
38 "domAutomationController.send(location.protocol)", | 37 "domAutomationController.send(location.protocol)", |
39 &out)); | 38 &out)); |
40 ASSERT_EQ("chrome-extension:", out); | 39 ASSERT_EQ("chrome-extension:", out); |
41 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString( | 40 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
42 tab->GetRenderViewHost(), | 41 tab, |
43 "", | |
44 "domAutomationController.send(location.pathname)", | 42 "domAutomationController.send(location.pathname)", |
45 &out)); | 43 &out)); |
46 ASSERT_EQ("/main.html", out); | 44 ASSERT_EQ("/main.html", out); |
47 } | 45 } |
48 }; | 46 }; |
49 | 47 |
50 IN_PROC_BROWSER_TEST_F(BookmarksTest, ShouldRedirectToExtension) { | 48 IN_PROC_BROWSER_TEST_F(BookmarksTest, ShouldRedirectToExtension) { |
51 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL)); | 49 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL)); |
52 AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents()); | 50 AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents()); |
53 } | 51 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 navigation_observer.Wait(); | 90 navigation_observer.Wait(); |
93 | 91 |
94 ASSERT_EQ(1, browser()->tab_count()); | 92 ASSERT_EQ(1, browser()->tab_count()); |
95 } | 93 } |
96 | 94 |
97 IN_PROC_BROWSER_TEST_F(BookmarksTest, BookmarksLoaded) { | 95 IN_PROC_BROWSER_TEST_F(BookmarksTest, BookmarksLoaded) { |
98 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL)); | 96 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIBookmarksURL)); |
99 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 97 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
100 AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents()); | 98 AssertIsBookmarksPage(browser()->tab_strip_model()->GetActiveWebContents()); |
101 } | 99 } |
OLD | NEW |