| 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/browser/ui/webui/options/preferences_browsertest.h" | 5 #include "chrome/browser/ui/webui/options/preferences_browsertest.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Navigates to the settings page, causing the JavaScript pref handling code to | 71 // Navigates to the settings page, causing the JavaScript pref handling code to |
| 72 // load and injects JavaScript testing code. | 72 // load and injects JavaScript testing code. |
| 73 void PreferencesBrowserTest::SetUpOnMainThread() { | 73 void PreferencesBrowserTest::SetUpOnMainThread() { |
| 74 ui_test_utils::NavigateToURL(browser(), | 74 ui_test_utils::NavigateToURL(browser(), |
| 75 GURL(chrome::kChromeUISettingsFrameURL)); | 75 GURL(chrome::kChromeUISettingsFrameURL)); |
| 76 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); | 76 content::WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
| 77 ASSERT_TRUE(web_contents); | 77 ASSERT_TRUE(web_contents); |
| 78 render_view_host_ = web_contents->GetRenderViewHost(); | 78 render_view_host_ = web_contents->GetRenderViewHost(); |
| 79 ASSERT_TRUE(render_view_host_); | 79 ASSERT_TRUE(render_view_host_); |
| 80 pref_change_registrar_.Init( | 80 pref_change_registrar_.Init( |
| 81 PrefServiceBase::ForProfile(browser()->profile())); | 81 PrefServiceBase::ForContext(browser()->profile())); |
| 82 pref_service_ = browser()->profile()->GetPrefs(); | 82 pref_service_ = browser()->profile()->GetPrefs(); |
| 83 ASSERT_TRUE(content::ExecuteJavaScript(render_view_host_, L"", | 83 ASSERT_TRUE(content::ExecuteJavaScript(render_view_host_, L"", |
| 84 L"function TestEnv() {" | 84 L"function TestEnv() {" |
| 85 L" this.sentinelName_ = 'profile.exited_cleanly';" | 85 L" this.sentinelName_ = 'profile.exited_cleanly';" |
| 86 L" this.prefs_ = [];" | 86 L" this.prefs_ = [];" |
| 87 L" TestEnv.instance_ = this;" | 87 L" TestEnv.instance_ = this;" |
| 88 L"}" | 88 L"}" |
| 89 L"" | 89 L"" |
| 90 L"TestEnv.handleEvent = function(event) {" | 90 L"TestEnv.handleEvent = function(event) {" |
| 91 L" var env = TestEnv.instance_;" | 91 L" var env = TestEnv.instance_;" |
| (...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 // Do not set the Boolean pref. It will toogle automatically. | 727 // Do not set the Boolean pref. It will toogle automatically. |
| 728 for (size_t i = 1; i < pref_names_.size(); ++i) | 728 for (size_t i = 1; i < pref_names_.size(); ++i) |
| 729 chromeos::proxy_cros_settings_parser::SetProxyPrefValue( | 729 chromeos::proxy_cros_settings_parser::SetProxyPrefValue( |
| 730 profile, pref_names_[i], non_default_values_[i]->DeepCopy()); | 730 profile, pref_names_[i], non_default_values_[i]->DeepCopy()); |
| 731 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); | 731 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); |
| 732 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, | 732 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, |
| 733 "", false); | 733 "", false); |
| 734 } | 734 } |
| 735 | 735 |
| 736 #endif | 736 #endif |
| OLD | NEW |