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

Side by Side Diff: chrome/installer/util/master_preferences_unittest.cc

Issue 99923002: Move temp file functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 // Unit tests for master preferences related methods. 5 // Unit tests for master preferences related methods.
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "chrome/installer/util/master_preferences.h" 14 #include "chrome/installer/util/master_preferences.h"
15 #include "chrome/installer/util/master_preferences_constants.h" 15 #include "chrome/installer/util/master_preferences_constants.h"
16 #include "chrome/installer/util/util_constants.h" 16 #include "chrome/installer/util/util_constants.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace { 19 namespace {
20 class MasterPreferencesTest : public testing::Test { 20 class MasterPreferencesTest : public testing::Test {
21 protected: 21 protected:
22 virtual void SetUp() { 22 virtual void SetUp() {
23 ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file_)); 23 ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file_));
24 } 24 }
25 25
26 virtual void TearDown() { 26 virtual void TearDown() {
27 EXPECT_TRUE(base::DeleteFile(prefs_file_, false)); 27 EXPECT_TRUE(base::DeleteFile(prefs_file_, false));
28 } 28 }
29 29
30 const base::FilePath& prefs_file() const { return prefs_file_; } 30 const base::FilePath& prefs_file() const { return prefs_file_; }
31 31
32 private: 32 private:
33 base::FilePath prefs_file_; 33 base::FilePath prefs_file_;
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 "behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.name", &name)); 234 "behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.name", &name));
235 std::string version; 235 std::string version;
236 EXPECT_TRUE(extensions->GetString( 236 EXPECT_TRUE(extensions->GetString(
237 "behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.version", &version)); 237 "behllobkkfkfnphdnhnkndlbkcpglgmj.manifest.version", &version));
238 } 238 }
239 239
240 // Test that we are parsing master preferences correctly. 240 // Test that we are parsing master preferences correctly.
241 TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) { 241 TEST_F(MasterPreferencesTest, GetInstallPreferencesTest) {
242 // Create a temporary prefs file. 242 // Create a temporary prefs file.
243 base::FilePath prefs_file; 243 base::FilePath prefs_file;
244 ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file)); 244 ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file));
245 const char text[] = 245 const char text[] =
246 "{ \n" 246 "{ \n"
247 " \"distribution\": { \n" 247 " \"distribution\": { \n"
248 " \"do_not_create_desktop_shortcut\": false,\n" 248 " \"do_not_create_desktop_shortcut\": false,\n"
249 " \"do_not_create_quick_launch_shortcut\": false,\n" 249 " \"do_not_create_quick_launch_shortcut\": false,\n"
250 " \"do_not_launch_chrome\": true,\n" 250 " \"do_not_launch_chrome\": true,\n"
251 " \"system_level\": true,\n" 251 " \"system_level\": true,\n"
252 " \"verbose_logging\": false\n" 252 " \"verbose_logging\": false\n"
253 " }\n" 253 " }\n"
254 "} \n"; 254 "} \n";
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 // The MasterPreferences dictionary should also conjure up the new setting 496 // The MasterPreferences dictionary should also conjure up the new setting
497 // as per EnforceLegacyPreferences. 497 // as per EnforceLegacyPreferences.
498 const base::ListValue* new_startup_urls_list = NULL; 498 const base::ListValue* new_startup_urls_list = NULL;
499 EXPECT_TRUE(master_dictionary.GetList(prefs::kURLsToRestoreOnStartup, 499 EXPECT_TRUE(master_dictionary.GetList(prefs::kURLsToRestoreOnStartup,
500 &new_startup_urls_list)); 500 &new_startup_urls_list));
501 ASSERT_TRUE(new_startup_urls_list != NULL); 501 ASSERT_TRUE(new_startup_urls_list != NULL);
502 std::string new_url_value; 502 std::string new_url_value;
503 EXPECT_TRUE(new_startup_urls_list->GetString(0, &new_url_value)); 503 EXPECT_TRUE(new_startup_urls_list->GetString(0, &new_url_value));
504 EXPECT_EQ("http://www.example.com", new_url_value); 504 EXPECT_EQ("http://www.example.com", new_url_value);
505 } 505 }
OLDNEW
« no previous file with comments | « chrome/installer/util/installer_state_unittest.cc ('k') | chrome/installer/util/shell_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698