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

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

Issue 11753009: Simplify ExecuteJavaScript* functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update prerender_browsertest.cc. Created 7 years, 11 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/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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/pdf/pdf_browsertest.cc ('k') | chrome/browser/ui/webui/inspect_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698