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

Side by Side Diff: chrome/browser/chromeos/extensions/default_app_order_unittest.cc

Issue 2318023002: //chrome/browser/chromeos: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Address comment and also remove non-trivial cases 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 (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 #include "chrome/browser/chromeos/extensions/default_app_order.h" 5 #include "chrome/browser/chromeos/extensions/default_app_order.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return true; 48 return true;
49 } 49 }
50 50
51 void SetExternalFile(const base::FilePath& path) { 51 void SetExternalFile(const base::FilePath& path) {
52 path_override_.reset(new base::ScopedPathOverride( 52 path_override_.reset(new base::ScopedPathOverride(
53 chromeos::FILE_DEFAULT_APP_ORDER, path)); 53 chromeos::FILE_DEFAULT_APP_ORDER, path));
54 } 54 }
55 55
56 void CreateExternalOrderFile(const std::string& content) { 56 void CreateExternalOrderFile(const std::string& content) {
57 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 57 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
58 base::FilePath external_file = temp_dir_.path().Append(kTestFile); 58 base::FilePath external_file = temp_dir_.GetPath().Append(kTestFile);
59 base::WriteFile(external_file, content.c_str(), content.size()); 59 base::WriteFile(external_file, content.c_str(), content.size());
60 SetExternalFile(external_file); 60 SetExternalFile(external_file);
61 } 61 }
62 62
63 private: 63 private:
64 std::vector<std::string> built_in_default_; 64 std::vector<std::string> built_in_default_;
65 65
66 base::ScopedTempDir temp_dir_; 66 base::ScopedTempDir temp_dir_;
67 std::unique_ptr<base::ScopedPathOverride> path_override_; 67 std::unique_ptr<base::ScopedPathOverride> path_override_;
68 68
(...skipping 26 matching lines...) Expand all
95 EXPECT_EQ(std::string("app3"), apps[2]); 95 EXPECT_EQ(std::string("app3"), apps[2]);
96 EXPECT_EQ(std::string("OEM name"), default_app_order::GetOemAppsFolderName()); 96 EXPECT_EQ(std::string("OEM name"), default_app_order::GetOemAppsFolderName());
97 } 97 }
98 98
99 // Tests none-existent order file gives built-in default. 99 // Tests none-existent order file gives built-in default.
100 TEST_F(DefaultAppOrderTest, NoExternalFile) { 100 TEST_F(DefaultAppOrderTest, NoExternalFile) {
101 base::ScopedTempDir scoped_tmp_dir; 101 base::ScopedTempDir scoped_tmp_dir;
102 ASSERT_TRUE(scoped_tmp_dir.CreateUniqueTempDir()); 102 ASSERT_TRUE(scoped_tmp_dir.CreateUniqueTempDir());
103 103
104 base::FilePath none_existent_file = 104 base::FilePath none_existent_file =
105 scoped_tmp_dir.path().AppendASCII("none_existent_file"); 105 scoped_tmp_dir.GetPath().AppendASCII("none_existent_file");
106 ASSERT_FALSE(base::PathExists(none_existent_file)); 106 ASSERT_FALSE(base::PathExists(none_existent_file));
107 SetExternalFile(none_existent_file); 107 SetExternalFile(none_existent_file);
108 108
109 std::unique_ptr<default_app_order::ExternalLoader> loader( 109 std::unique_ptr<default_app_order::ExternalLoader> loader(
110 new default_app_order::ExternalLoader(false)); 110 new default_app_order::ExternalLoader(false));
111 111
112 std::vector<std::string> apps; 112 std::vector<std::string> apps;
113 default_app_order::Get(&apps); 113 default_app_order::Get(&apps);
114 EXPECT_TRUE(IsBuiltInDefault(apps)); 114 EXPECT_TRUE(IsBuiltInDefault(apps));
115 } 115 }
(...skipping 23 matching lines...) Expand all
139 std::vector<std::string> apps; 139 std::vector<std::string> apps;
140 default_app_order::Get(&apps); 140 default_app_order::Get(&apps);
141 EXPECT_EQ(default_app_order::kDefaultAppOrderCount + 2, apps.size()); 141 EXPECT_EQ(default_app_order::kDefaultAppOrderCount + 2, apps.size());
142 EXPECT_EQ(std::string("app1"), apps[0]); 142 EXPECT_EQ(std::string("app1"), apps[0]);
143 EXPECT_EQ(extension_misc::kChromeAppId, apps[1]); 143 EXPECT_EQ(extension_misc::kChromeAppId, apps[1]);
144 EXPECT_EQ(std::string("app2"), 144 EXPECT_EQ(std::string("app2"),
145 apps[default_app_order::kDefaultAppOrderCount + 1]); 145 apps[default_app_order::kDefaultAppOrderCount + 1]);
146 } 146 }
147 147
148 } // namespace chromeos 148 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698