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

Side by Side Diff: chromecast/base/error_codes_unittest.cc

Issue 2322573002: misc files A-P: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chromecast/base/error_codes.h" 5 #include "chromecast/base/error_codes.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/test/scoped_path_override.h" 13 #include "base/test/scoped_path_override.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace chromecast { 16 namespace chromecast {
17 17
18 class ErrorCodesTest : public testing::Test { 18 class ErrorCodesTest : public testing::Test {
19 protected: 19 protected:
20 ErrorCodesTest() {} 20 ErrorCodesTest() {}
21 ~ErrorCodesTest() override {} 21 ~ErrorCodesTest() override {}
22 22
23 void SetUp() override { 23 void SetUp() override {
24 // Set up a temporary directory which will be used as our fake home dir. 24 // Set up a temporary directory which will be used as our fake home dir.
25 ASSERT_TRUE(fake_home_dir_.CreateUniqueTempDir()); 25 ASSERT_TRUE(fake_home_dir_.CreateUniqueTempDir());
26 path_override_.reset( 26 path_override_.reset(
27 new base::ScopedPathOverride(base::DIR_HOME, fake_home_dir_.path())); 27 new base::ScopedPathOverride(base::DIR_HOME, fake_home_dir_.GetPath()));
28 } 28 }
29 29
30 base::FilePath home_path() const { return fake_home_dir_.path(); } 30 base::FilePath home_path() const { return fake_home_dir_.GetPath(); }
31 31
32 private: 32 private:
33 base::ScopedTempDir fake_home_dir_; 33 base::ScopedTempDir fake_home_dir_;
34 std::unique_ptr<base::ScopedPathOverride> path_override_; 34 std::unique_ptr<base::ScopedPathOverride> path_override_;
35 }; 35 };
36 36
37 TEST_F(ErrorCodesTest, GetInitialErrorCodeReturnsNoErrorIfMissingFile) { 37 TEST_F(ErrorCodesTest, GetInitialErrorCodeReturnsNoErrorIfMissingFile) {
38 EXPECT_EQ(NO_ERROR, GetInitialErrorCode()); 38 EXPECT_EQ(NO_ERROR, GetInitialErrorCode());
39 } 39 }
40 40
(...skipping 21 matching lines...) Expand all
62 EXPECT_TRUE(base::PathExists(home_path().Append("initial_error"))); 62 EXPECT_TRUE(base::PathExists(home_path().Append("initial_error")));
63 EXPECT_EQ(ERROR_WEB_CONTENT_NAME_NOT_RESOLVED, GetInitialErrorCode()); 63 EXPECT_EQ(ERROR_WEB_CONTENT_NAME_NOT_RESOLVED, GetInitialErrorCode());
64 64
65 // File should be removed after writing NO_ERROR. 65 // File should be removed after writing NO_ERROR.
66 EXPECT_TRUE(SetInitialErrorCode(NO_ERROR)); 66 EXPECT_TRUE(SetInitialErrorCode(NO_ERROR));
67 EXPECT_FALSE(base::PathExists(home_path().Append("initial_error"))); 67 EXPECT_FALSE(base::PathExists(home_path().Append("initial_error")));
68 EXPECT_EQ(NO_ERROR, GetInitialErrorCode()); 68 EXPECT_EQ(NO_ERROR, GetInitialErrorCode());
69 } 69 }
70 70
71 } // namespace chromecast 71 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698