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

Side by Side Diff: chrome/browser/do_not_track_browsertest.cc

Issue 11728003: Change ExecuteJavaScript* helper functions in browser_test_utils.{h,cc} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding files for gpu_tests and NaCl browser tests. 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 "base/string16.h" 5 #include "base/string16.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_tabstrip.h" 10 #include "chrome/browser/ui/browser_tabstrip.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 IN_PROC_BROWSER_TEST_F(DoNotTrackTest, DOMProperty) { 60 IN_PROC_BROWSER_TEST_F(DoNotTrackTest, DOMProperty) {
61 PrefService* prefs = browser()->profile()->GetPrefs(); 61 PrefService* prefs = browser()->profile()->GetPrefs();
62 prefs->SetBoolean(prefs::kEnableDoNotTrack, true); 62 prefs->SetBoolean(prefs::kEnableDoNotTrack, true);
63 63
64 ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop( 64 ASSERT_NO_FATAL_FAILURE(content::WaitForLoadStop(
65 chrome::GetActiveWebContents(browser()))); 65 chrome::GetActiveWebContents(browser())));
66 66
67 std::string do_not_track; 67 std::string do_not_track;
68 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractString( 68 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractString(
69 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 69 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
70 std::wstring(), 70 "",
71 L"window.domAutomationController.send(navigator.doNotTrack)", 71 "window.domAutomationController.send(navigator.doNotTrack)",
72 &do_not_track)); 72 &do_not_track));
73 EXPECT_EQ("1", do_not_track); 73 EXPECT_EQ("1", do_not_track);
74 74
75 // Reset flag and check that the changed value is propagated to the existing 75 // Reset flag and check that the changed value is propagated to the existing
76 // renderer. 76 // renderer.
77 prefs->SetBoolean(prefs::kEnableDoNotTrack, false); 77 prefs->SetBoolean(prefs::kEnableDoNotTrack, false);
78 78
79 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractString( 79 EXPECT_TRUE(content::ExecuteJavaScriptAndExtractString(
80 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 80 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
81 std::wstring(), 81 "",
82 L"window.domAutomationController.send(" 82 "window.domAutomationController.send("
83 L"navigator.doNotTrack === null ? '0' : '1')", 83 " navigator.doNotTrack === null ? '0' : '1')",
84 &do_not_track)); 84 &do_not_track));
85 EXPECT_EQ("0", do_not_track); 85 EXPECT_EQ("0", do_not_track);
86 } 86 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_sanity_browsertest.cc ('k') | chrome/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698