OLD | NEW |
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/files/file_util.h" | 7 #include "base/files/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 void SetUp() override { |
23 ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file_)); | 23 ASSERT_TRUE(base::CreateTemporaryFile(&prefs_file_)); |
24 } | 24 } |
25 | 25 |
26 virtual void TearDown() { | 26 void TearDown() override { |
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_; |
34 }; | 34 }; |
35 | 35 |
36 // Used to specify an expected value for a set boolean preference variable. | 36 // Used to specify an expected value for a set boolean preference variable. |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 // The MasterPreferences dictionary should also conjure up the new setting | 473 // The MasterPreferences dictionary should also conjure up the new setting |
474 // as per EnforceLegacyPreferences. | 474 // as per EnforceLegacyPreferences. |
475 const base::ListValue* new_startup_urls_list = NULL; | 475 const base::ListValue* new_startup_urls_list = NULL; |
476 EXPECT_TRUE(master_dictionary.GetList(prefs::kURLsToRestoreOnStartup, | 476 EXPECT_TRUE(master_dictionary.GetList(prefs::kURLsToRestoreOnStartup, |
477 &new_startup_urls_list)); | 477 &new_startup_urls_list)); |
478 ASSERT_TRUE(new_startup_urls_list != NULL); | 478 ASSERT_TRUE(new_startup_urls_list != NULL); |
479 std::string new_url_value; | 479 std::string new_url_value; |
480 EXPECT_TRUE(new_startup_urls_list->GetString(0, &new_url_value)); | 480 EXPECT_TRUE(new_startup_urls_list->GetString(0, &new_url_value)); |
481 EXPECT_EQ("http://www.example.com", new_url_value); | 481 EXPECT_EQ("http://www.example.com", new_url_value); |
482 } | 482 } |
OLD | NEW |