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

Side by Side Diff: content/browser/dom_storage/dom_storage_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
« no previous file with comments | « content/browser/database_browsertest.cc ('k') | content/browser/encrypted_media_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/path_service.h" 5 #include "base/path_service.h"
6 #include "content/browser/web_contents/web_contents_impl.h" 6 #include "content/browser/web_contents/web_contents_impl.h"
7 #include "content/public/common/content_paths.h" 7 #include "content/public/common/content_paths.h"
8 #include "content/public/test/browser_test_utils.h" 8 #include "content/public/test/browser_test_utils.h"
9 #include "content/shell/shell.h" 9 #include "content/shell/shell.h"
10 #include "content/test/content_browser_test.h" 10 #include "content/test/content_browser_test.h"
(...skipping 10 matching lines...) Expand all
21 DomStorageBrowserTest() {} 21 DomStorageBrowserTest() {}
22 22
23 void SimpleTest(const GURL& test_url, bool incognito) { 23 void SimpleTest(const GURL& test_url, bool incognito) {
24 // The test page will perform tests then navigate to either 24 // The test page will perform tests then navigate to either
25 // a #pass or #fail ref. 25 // a #pass or #fail ref.
26 Shell* the_browser = incognito ? CreateOffTheRecordBrowser() : shell(); 26 Shell* the_browser = incognito ? CreateOffTheRecordBrowser() : shell();
27 NavigateToURLBlockUntilNavigationsComplete(the_browser, test_url, 2); 27 NavigateToURLBlockUntilNavigationsComplete(the_browser, test_url, 2);
28 std::string result = the_browser->web_contents()->GetURL().ref(); 28 std::string result = the_browser->web_contents()->GetURL().ref();
29 if (result != "pass") { 29 if (result != "pass") {
30 std::string js_result; 30 std::string js_result;
31 ASSERT_TRUE(ExecuteJavaScriptAndExtractString( 31 ASSERT_TRUE(ExecuteScriptAndExtractString(
32 the_browser->web_contents()->GetRenderViewHost(), 32 the_browser->web_contents(),
33 std::string(),
34 "window.domAutomationController.send(getLog())", 33 "window.domAutomationController.send(getLog())",
35 &js_result)); 34 &js_result));
36 FAIL() << "Failed: " << js_result; 35 FAIL() << "Failed: " << js_result;
37 } 36 }
38 } 37 }
39 }; 38 };
40 39
41 static const bool kIncognito = true; 40 static const bool kIncognito = true;
42 static const bool kNotIncognito = false; 41 static const bool kNotIncognito = false;
43 42
44 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheck) { 43 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheck) {
45 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito); 44 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kNotIncognito);
46 } 45 }
47 46
48 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheckIncognito) { 47 IN_PROC_BROWSER_TEST_F(DomStorageBrowserTest, SanityCheckIncognito) {
49 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito); 48 SimpleTest(GetTestUrl("dom_storage", "sanity_check.html"), kIncognito);
50 } 49 }
51 50
52 } // namespace content 51 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/database_browsertest.cc ('k') | content/browser/encrypted_media_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698