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

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_unittest.cc

Issue 2419733005: Extract a base class from CommandLinePrefStore (Closed)
Patch Set: nit in comment Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <memory> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/browser/prefs/browser_prefs.h" 14 #include "chrome/browser/prefs/browser_prefs.h"
15 #include "chrome/browser/prefs/command_line_pref_store.h" 15 #include "chrome/browser/prefs/chrome_command_line_pref_store.h"
16 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
20 #include "chrome/test/base/testing_profile.h" 20 #include "chrome/test/base/testing_profile.h"
21 #include "components/policy/core/browser/configuration_policy_pref_store.h" 21 #include "components/policy/core/browser/configuration_policy_pref_store.h"
22 #include "components/policy/core/common/mock_configuration_policy_provider.h" 22 #include "components/policy/core/common/mock_configuration_policy_provider.h"
23 #include "components/pref_registry/pref_registry_syncable.h" 23 #include "components/pref_registry/pref_registry_syncable.h"
24 #include "components/prefs/pref_registry_simple.h" 24 #include "components/prefs/pref_registry_simple.h"
25 #include "components/prefs/scoped_user_pref_update.h" 25 #include "components/prefs/scoped_user_pref_update.h"
(...skipping 19 matching lines...) Expand all
45 EXPECT_EQ(base::Value::TYPE_BOOLEAN, value->GetType()); 45 EXPECT_EQ(base::Value::TYPE_BOOLEAN, value->GetType());
46 bool actual_bool_value = true; 46 bool actual_bool_value = true;
47 EXPECT_TRUE(value->GetAsBoolean(&actual_bool_value)); 47 EXPECT_TRUE(value->GetAsBoolean(&actual_bool_value));
48 EXPECT_FALSE(actual_bool_value); 48 EXPECT_FALSE(actual_bool_value);
49 49
50 // Change the command line. 50 // Change the command line.
51 base::CommandLine cmd_line(base::CommandLine::NO_PROGRAM); 51 base::CommandLine cmd_line(base::CommandLine::NO_PROGRAM);
52 cmd_line.AppendSwitch(switches::kEnableCloudPrintProxy); 52 cmd_line.AppendSwitch(switches::kEnableCloudPrintProxy);
53 53
54 // Call UpdateCommandLinePrefStore and check to see if the value has changed. 54 // Call UpdateCommandLinePrefStore and check to see if the value has changed.
55 prefs.UpdateCommandLinePrefStore(new CommandLinePrefStore(&cmd_line)); 55 prefs.UpdateCommandLinePrefStore(new ChromeCommandLinePrefStore(&cmd_line));
56 pref = prefs.FindPreference(prefs::kCloudPrintProxyEnabled); 56 pref = prefs.FindPreference(prefs::kCloudPrintProxyEnabled);
57 ASSERT_TRUE(pref); 57 ASSERT_TRUE(pref);
58 value = pref->GetValue(); 58 value = pref->GetValue();
59 ASSERT_TRUE(value); 59 ASSERT_TRUE(value);
60 EXPECT_EQ(base::Value::TYPE_BOOLEAN, value->GetType()); 60 EXPECT_EQ(base::Value::TYPE_BOOLEAN, value->GetType());
61 actual_bool_value = false; 61 actual_bool_value = false;
62 EXPECT_TRUE(value->GetAsBoolean(&actual_bool_value)); 62 EXPECT_TRUE(value->GetAsBoolean(&actual_bool_value));
63 EXPECT_TRUE(actual_bool_value); 63 EXPECT_TRUE(actual_bool_value);
64 } 64 }
65 65
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 const char kDefaultFont[] = "Times"; 129 const char kDefaultFont[] = "Times";
130 #elif defined(OS_CHROMEOS) 130 #elif defined(OS_CHROMEOS)
131 const char kDefaultFont[] = "Tinos"; 131 const char kDefaultFont[] = "Tinos";
132 #else 132 #else
133 const char kDefaultFont[] = "Times New Roman"; 133 const char kDefaultFont[] = "Times New Roman";
134 #endif 134 #endif
135 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont), 135 EXPECT_EQ(base::ASCIIToUTF16(kDefaultFont),
136 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]); 136 webkit_prefs.standard_font_family_map[prefs::kWebKitCommonScript]);
137 EXPECT_TRUE(webkit_prefs.javascript_enabled); 137 EXPECT_TRUE(webkit_prefs.javascript_enabled);
138 } 138 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/chrome_pref_service_factory.cc ('k') | chrome/browser/prefs/command_line_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698