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

Side by Side Diff: chrome/browser/ui/webui/options/preferences_browsertest.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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/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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 L"" 155 L""
156 L" finishObservingAndReply: function() {" 156 L" finishObservingAndReply: function() {"
157 L" this.sentinelValue_ = !this.sentinelValue_;" 157 L" this.sentinelValue_ = !this.sentinelValue_;"
158 L" Preferences.setBooleanPref(this.sentinelName_, this.sentinelValue_," 158 L" Preferences.setBooleanPref(this.sentinelName_, this.sentinelValue_,"
159 L" true);" 159 L" true);"
160 L" }" 160 L" }"
161 L"};")); 161 L"};"));
162 } 162 }
163 163
164 // Forwards notifications received when pref values change in the backend. 164 // Forwards notifications received when pref values change in the backend.
165 void PreferencesBrowserTest::Observe( 165 void PreferencesBrowserTest::OnPreferenceChanged(PrefServiceBase* service,
166 int type, 166 const std::string& pref_name) {
167 const content::NotificationSource& source, 167 ASSERT_EQ(pref_service_, service);
168 const content::NotificationDetails& details) { 168 OnCommit(pref_service_->FindPreference(pref_name.c_str()));
169 ASSERT_EQ(chrome::NOTIFICATION_PREF_CHANGED, type);
170 ASSERT_EQ(pref_service_, content::Source<PrefService>(source).ptr());
171 const std::string& name = *content::Details<std::string>(details).ptr();
172 OnCommit(pref_service_->FindPreference(name.c_str()));
173 } 169 }
174 170
175 // Sets up a mock user policy provider. 171 // Sets up a mock user policy provider.
176 void PreferencesBrowserTest::SetUpInProcessBrowserTestFixture() { 172 void PreferencesBrowserTest::SetUpInProcessBrowserTestFixture() {
177 EXPECT_CALL(policy_provider_, IsInitializationComplete()) 173 EXPECT_CALL(policy_provider_, IsInitializationComplete())
178 .WillRepeatedly(Return(true)); 174 .WillRepeatedly(Return(true));
179 policy::BrowserPolicyConnector::SetPolicyProviderForTesting( 175 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(
180 &policy_provider_); 176 &policy_provider_);
181 }; 177 };
182 178
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 // Do not set the Boolean pref. It will toogle automatically. 728 // Do not set the Boolean pref. It will toogle automatically.
733 for (size_t i = 1; i < pref_names_.size(); ++i) 729 for (size_t i = 1; i < pref_names_.size(); ++i)
734 chromeos::proxy_cros_settings_parser::SetProxyPrefValue( 730 chromeos::proxy_cros_settings_parser::SetProxyPrefValue(
735 profile, pref_names_[i], non_default_values_[i]->DeepCopy()); 731 profile, pref_names_[i], non_default_values_[i]->DeepCopy());
736 SetupJavaScriptTestEnvironment(pref_names_, &observed_json); 732 SetupJavaScriptTestEnvironment(pref_names_, &observed_json);
737 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_, 733 VerifyObservedPrefs(observed_json, pref_names_, non_default_values_,
738 "", false, false); 734 "", false, false);
739 } 735 }
740 736
741 #endif 737 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options/preferences_browsertest.h ('k') | chrome/browser/ui/webui/options/startup_pages_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698