| 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 "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 Loading... |
| 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 "", | 70 std::wstring(), |
| 71 "window.domAutomationController.send(navigator.doNotTrack)", | 71 L"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 "", | 81 std::wstring(), |
| 82 "window.domAutomationController.send(" | 82 L"window.domAutomationController.send(" |
| 83 " navigator.doNotTrack === null ? '0' : '1')", | 83 L"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 } |
| OLD | NEW |