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

Side by Side Diff: chrome/browser/extensions/extension_service_test_base.cc

Issue 2314363002: extensions: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Comment addressed 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/extensions/extension_service_test_base.h" 5 #include "chrome/browser/extensions/extension_service_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 // Why? Because |profile_| has to be destroyed before |at_exit_manager_|, but 106 // Why? Because |profile_| has to be destroyed before |at_exit_manager_|, but
107 // is declared above it in the class definition since it's protected. 107 // is declared above it in the class definition since it's protected.
108 profile_.reset(); 108 profile_.reset();
109 } 109 }
110 110
111 ExtensionServiceTestBase::ExtensionServiceInitParams 111 ExtensionServiceTestBase::ExtensionServiceInitParams
112 ExtensionServiceTestBase::CreateDefaultInitParams() { 112 ExtensionServiceTestBase::CreateDefaultInitParams() {
113 ExtensionServiceInitParams params; 113 ExtensionServiceInitParams params;
114 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir()); 114 EXPECT_TRUE(temp_dir_.CreateUniqueTempDir());
115 base::FilePath path = temp_dir_.path(); 115 base::FilePath path = temp_dir_.GetPath();
116 path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); 116 path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath"));
117 EXPECT_TRUE(base::DeleteFile(path, true)); 117 EXPECT_TRUE(base::DeleteFile(path, true));
118 base::File::Error error = base::File::FILE_OK; 118 base::File::Error error = base::File::FILE_OK;
119 EXPECT_TRUE(base::CreateDirectoryAndGetError(path, &error)) << error; 119 EXPECT_TRUE(base::CreateDirectoryAndGetError(path, &error)) << error;
120 base::FilePath prefs_filename = 120 base::FilePath prefs_filename =
121 path.Append(FILE_PATH_LITERAL("TestPreferences")); 121 path.Append(FILE_PATH_LITERAL("TestPreferences"));
122 base::FilePath extensions_install_dir = 122 base::FilePath extensions_install_dir =
123 path.Append(FILE_PATH_LITERAL("Extensions")); 123 path.Append(FILE_PATH_LITERAL("Extensions"));
124 EXPECT_TRUE(base::DeleteFile(extensions_install_dir, true)); 124 EXPECT_TRUE(base::DeleteFile(extensions_install_dir, true));
125 EXPECT_TRUE(base::CreateDirectoryAndGetError(extensions_install_dir, &error)) 125 EXPECT_TRUE(base::CreateDirectoryAndGetError(extensions_install_dir, &error))
(...skipping 19 matching lines...) Expand all
145 } 145 }
146 146
147 void ExtensionServiceTestBase::InitializeEmptyExtensionService() { 147 void ExtensionServiceTestBase::InitializeEmptyExtensionService() {
148 InitializeExtensionService(CreateDefaultInitParams()); 148 InitializeExtensionService(CreateDefaultInitParams());
149 } 149 }
150 150
151 void ExtensionServiceTestBase::InitializeInstalledExtensionService( 151 void ExtensionServiceTestBase::InitializeInstalledExtensionService(
152 const base::FilePath& prefs_file, 152 const base::FilePath& prefs_file,
153 const base::FilePath& source_install_dir) { 153 const base::FilePath& source_install_dir) {
154 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 154 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
155 base::FilePath path = temp_dir_.path(); 155 base::FilePath path = temp_dir_.GetPath();
156 156
157 path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath")); 157 path = path.Append(FILE_PATH_LITERAL("TestingExtensionsPath"));
158 ASSERT_TRUE(base::DeleteFile(path, true)); 158 ASSERT_TRUE(base::DeleteFile(path, true));
159 159
160 base::File::Error error = base::File::FILE_OK; 160 base::File::Error error = base::File::FILE_OK;
161 ASSERT_TRUE(base::CreateDirectoryAndGetError(path, &error)) << error; 161 ASSERT_TRUE(base::CreateDirectoryAndGetError(path, &error)) << error;
162 162
163 base::FilePath temp_prefs = path.Append(chrome::kPreferencesFilename); 163 base::FilePath temp_prefs = path.Append(chrome::kPreferencesFilename);
164 ASSERT_TRUE(base::CopyFile(prefs_file, temp_prefs)); 164 ASSERT_TRUE(base::CopyFile(prefs_file, temp_prefs));
165 165
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 330
331 service_->RegisterInstallGate(ExtensionPrefs::DELAY_REASON_WAIT_FOR_IMPORTS, 331 service_->RegisterInstallGate(ExtensionPrefs::DELAY_REASON_WAIT_FOR_IMPORTS,
332 service_->shared_module_service()); 332 service_->shared_module_service());
333 333
334 #if defined(OS_CHROMEOS) 334 #if defined(OS_CHROMEOS)
335 InstallLimiter::Get(profile_.get())->DisableForTest(); 335 InstallLimiter::Get(profile_.get())->DisableForTest();
336 #endif 336 #endif
337 } 337 }
338 338
339 } // namespace extensions 339 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698