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

Unified Diff: chrome/browser/prefs/pref_service_unittest.cc

Issue 9251026: Reinitialize LocalState's CommandLinePrefStore after about_flags updates the command line. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix presubmit checks, no code change Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prefs/pref_service.cc ('k') | chrome/browser/prefs/pref_value_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_service_unittest.cc
===================================================================
--- chrome/browser/prefs/pref_service_unittest.cc (revision 118876)
+++ chrome/browser/prefs/pref_service_unittest.cc (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -22,7 +22,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_pref_service.h"
-#include "chrome/test/base/testing_pref_service.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/tab_contents/test_tab_contents.h"
#include "content/test/test_browser_thread.h"
@@ -150,6 +149,37 @@
EXPECT_EQ(kTestValue, actual_int_value);
}
+TEST(PrefServiceTest, UpdateCommandLinePrefStore) {
+ TestingPrefService prefs;
+ prefs.RegisterBooleanPref(prefs::kCloudPrintProxyEnabled, false);
+
+ // Check to make sure the value is as expected.
+ const PrefService::Preference* pref =
+ prefs.FindPreference(prefs::kCloudPrintProxyEnabled);
+ ASSERT_TRUE(pref);
+ const Value* value = pref->GetValue();
+ ASSERT_TRUE(value);
+ EXPECT_EQ(Value::TYPE_BOOLEAN, value->GetType());
+ bool actual_bool_value = true;
+ EXPECT_TRUE(value->GetAsBoolean(&actual_bool_value));
+ EXPECT_EQ(false, actual_bool_value);
+
+ // Change the command line.
+ CommandLine cmd_line(CommandLine::NO_PROGRAM);
+ cmd_line.AppendSwitch(switches::kEnableCloudPrintProxy);
+
+ // Call UpdateCommandLinePrefStore and check to see if the value has changed.
+ prefs.UpdateCommandLinePrefStore(&cmd_line);
+ pref = prefs.FindPreference(prefs::kCloudPrintProxyEnabled);
+ ASSERT_TRUE(pref);
+ value = pref->GetValue();
+ ASSERT_TRUE(value);
+ EXPECT_EQ(Value::TYPE_BOOLEAN, value->GetType());
+ actual_bool_value = false;
+ EXPECT_TRUE(value->GetAsBoolean(&actual_bool_value));
+ EXPECT_EQ(true, actual_bool_value);
+}
+
class PrefServiceSetValueTest : public testing::Test {
protected:
static const char kName[];
« no previous file with comments | « chrome/browser/prefs/pref_service.cc ('k') | chrome/browser/prefs/pref_value_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698