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

Unified Diff: chrome/browser/extensions/api/settings_private/settings_private_apitest.cc

Issue 1061613002: chrome.settingsPrivate: Implement onPrefsChanged event handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a direct memory leak Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/settings_private/settings_private_apitest.cc
diff --git a/chrome/browser/extensions/api/settings_private/settings_private_apitest.cc b/chrome/browser/extensions/api/settings_private/settings_private_apitest.cc
index 45d0679c96607bc776f2e3beacd6da1bf0bfb39c..818ec45b222274cc963cd0707cd53dcbbf214d0c 100644
--- a/chrome/browser/extensions/api/settings_private/settings_private_apitest.cc
+++ b/chrome/browser/extensions/api/settings_private/settings_private_apitest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/prefs/pref_service.h"
#include "base/values.h"
#include "chrome/browser/extensions/api/settings_private/settings_private_delegate.h"
#include "chrome/browser/extensions/api/settings_private/settings_private_delegate_factory.h"
@@ -16,14 +17,18 @@ namespace extensions {
namespace {
-const char kTestPrefName[] = "test.foo_bar";
-const char kTestPrefValue[] = "baz";
+const char kTestPrefName[] = "download.default_directory";
+const char kTestPrefValue[] = "/Downloads";
class TestDelegate : public SettingsPrivateDelegate {
public:
explicit TestDelegate(Profile* profile) : SettingsPrivateDelegate(profile) {}
bool SetPref(const std::string& name, const base::Value* value) override {
+ // Write to the actual pref service, so that the SettingsPrivateEventRouter
+ // dispatches an onPrefsChanged event.
+ PrefService* pref_service = profile_->GetPrefs();
+ pref_service->Set(name.c_str(), *value);
return true;
}
@@ -110,4 +115,8 @@ IN_PROC_BROWSER_TEST_F(SettingsPrivateApiTest, GetAllPrefs) {
EXPECT_TRUE(RunSettingsSubtest("getAllPrefs")) << message_;
}
+IN_PROC_BROWSER_TEST_F(SettingsPrivateApiTest, OnPrefsChanged) {
+ EXPECT_TRUE(RunSettingsSubtest("onPrefsChanged")) << message_;
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698