| 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" |
| 6 #include "base/compiler_specific.h" |
| 5 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" |
| 9 #include "base/scoped_temp_dir.h" |
| 6 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
| 7 #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" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 14 |
| 10 class FirstRunTest : public testing::Test { | 15 class FirstRunTest : public testing::Test { |
| 11 protected: | 16 protected: |
| 12 virtual void SetUp() { | 17 FirstRunTest() {} |
| 18 virtual ~FirstRunTest() {} |
| 19 |
| 20 virtual void SetUp() OVERRIDE { |
| 21 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 22 PathService::Override(chrome::DIR_USER_DATA, temp_dir_.path()); |
| 13 first_run::internal::GetFirstRunSentinelFilePath(&sentinel_path_); | 23 first_run::internal::GetFirstRunSentinelFilePath(&sentinel_path_); |
| 14 } | 24 } |
| 15 | 25 |
| 16 FilePath sentinel_path_; | 26 FilePath sentinel_path_; |
| 27 |
| 28 private: |
| 29 ScopedTempDir temp_dir_; |
| 30 |
| 31 DISALLOW_COPY_AND_ASSIGN(FirstRunTest); |
| 17 }; | 32 }; |
| 18 | 33 |
| 19 TEST_F(FirstRunTest, RemoveSentinel) { | 34 TEST_F(FirstRunTest, RemoveSentinel) { |
| 20 EXPECT_TRUE(first_run::CreateSentinel()); | 35 EXPECT_TRUE(first_run::CreateSentinel()); |
| 21 EXPECT_TRUE(file_util::PathExists(sentinel_path_)); | 36 EXPECT_TRUE(file_util::PathExists(sentinel_path_)); |
| 22 | 37 |
| 23 EXPECT_TRUE(first_run::RemoveSentinel()); | 38 EXPECT_TRUE(first_run::RemoveSentinel()); |
| 24 EXPECT_FALSE(file_util::PathExists(sentinel_path_)); | 39 EXPECT_FALSE(file_util::PathExists(sentinel_path_)); |
| 25 } | 40 } |
| OLD | NEW |