OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/test/scoped_path_override.h" | 9 #include "base/test/scoped_path_override.h" |
10 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
11 #include "chrome/browser/first_run/first_run_internal.h" | 11 #include "chrome/browser/first_run/first_run_internal.h" |
12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" |
13 #include "chrome/installer/util/master_preferences.h" | |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
16 namespace first_run { | |
gab
2013/02/11 23:44:01
I don't remember seeing tests inside a namespace i
Alexei Svitkine (slow)
2013/02/12 00:11:31
Sure, for example the majority of tests under gfx/
gab
2013/02/12 00:31:06
Sounds good, I personally prefer this syntax too F
| |
17 | |
15 class FirstRunTest : public testing::Test { | 18 class FirstRunTest : public testing::Test { |
16 protected: | 19 protected: |
17 FirstRunTest() : user_data_dir_override_(chrome::DIR_USER_DATA) {} | 20 FirstRunTest() : user_data_dir_override_(chrome::DIR_USER_DATA) {} |
18 virtual ~FirstRunTest() {} | 21 virtual ~FirstRunTest() {} |
19 | 22 |
20 virtual void SetUp() OVERRIDE { | 23 virtual void SetUp() OVERRIDE { |
21 first_run::internal::GetFirstRunSentinelFilePath(&sentinel_path_); | 24 internal::GetFirstRunSentinelFilePath(&sentinel_path_); |
22 } | 25 } |
23 | 26 |
24 base::FilePath sentinel_path_; | 27 base::FilePath sentinel_path_; |
25 | 28 |
26 private: | 29 private: |
27 base::ScopedPathOverride user_data_dir_override_; | 30 base::ScopedPathOverride user_data_dir_override_; |
28 | 31 |
29 DISALLOW_COPY_AND_ASSIGN(FirstRunTest); | 32 DISALLOW_COPY_AND_ASSIGN(FirstRunTest); |
30 }; | 33 }; |
31 | 34 |
32 TEST_F(FirstRunTest, RemoveSentinel) { | 35 TEST_F(FirstRunTest, RemoveSentinel) { |
33 EXPECT_TRUE(first_run::CreateSentinel()); | 36 EXPECT_TRUE(CreateSentinel()); |
34 EXPECT_TRUE(file_util::PathExists(sentinel_path_)); | 37 EXPECT_TRUE(file_util::PathExists(sentinel_path_)); |
35 | 38 |
36 EXPECT_TRUE(first_run::RemoveSentinel()); | 39 EXPECT_TRUE(RemoveSentinel()); |
37 EXPECT_FALSE(file_util::PathExists(sentinel_path_)); | 40 EXPECT_FALSE(file_util::PathExists(sentinel_path_)); |
38 } | 41 } |
42 | |
43 TEST_F(FirstRunTest, SetupMasterPrefsFromInstallPrefs_VariationsSeed) { | |
44 installer::MasterPreferences install_prefs("{ \"variations_seed\":\"xyz\" }"); | |
45 | |
46 MasterPrefs out_prefs; | |
47 internal::SetupMasterPrefsFromInstallPrefs(install_prefs, &out_prefs); | |
48 EXPECT_EQ("xyz", out_prefs.variations_seed); | |
49 } | |
50 | |
51 } // namespace first_run | |
gab
2013/02/11 23:44:01
nit: Does this file end with a new line? The linte
Alexei Svitkine (slow)
2013/02/12 00:11:31
No, it's a rietveld bug.
| |
OLD | NEW |