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

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

Issue 2318023002: //chrome/browser/chromeos: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Fix FileManagerBrowsertest 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/device_local_account_external_polic y_loader.h" 5 #include "chrome/browser/chromeos/extensions/device_local_account_external_polic y_loader.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 DeviceLocalAccountExternalPolicyLoaderTest() 134 DeviceLocalAccountExternalPolicyLoaderTest()
135 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { 135 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {
136 } 136 }
137 137
138 DeviceLocalAccountExternalPolicyLoaderTest:: 138 DeviceLocalAccountExternalPolicyLoaderTest::
139 ~DeviceLocalAccountExternalPolicyLoaderTest() { 139 ~DeviceLocalAccountExternalPolicyLoaderTest() {
140 } 140 }
141 141
142 void DeviceLocalAccountExternalPolicyLoaderTest::SetUp() { 142 void DeviceLocalAccountExternalPolicyLoaderTest::SetUp() {
143 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 143 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
144 cache_dir_ = temp_dir_.path().Append(kCacheDir); 144 cache_dir_ = temp_dir_.GetPath().Append(kCacheDir);
145 ASSERT_TRUE(base::CreateDirectoryAndGetError(cache_dir_, NULL)); 145 ASSERT_TRUE(base::CreateDirectoryAndGetError(cache_dir_, NULL));
146 request_context_getter_ = 146 request_context_getter_ =
147 new net::TestURLRequestContextGetter(base::ThreadTaskRunnerHandle::Get()); 147 new net::TestURLRequestContextGetter(base::ThreadTaskRunnerHandle::Get());
148 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( 148 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext(
149 request_context_getter_.get()); 149 request_context_getter_.get());
150 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir_)); 150 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir_));
151 151
152 loader_ = new DeviceLocalAccountExternalPolicyLoader(&store_, cache_dir_); 152 loader_ = new DeviceLocalAccountExternalPolicyLoader(&store_, cache_dir_);
153 provider_.reset(new extensions::ExternalProviderImpl( 153 provider_.reset(new extensions::ExternalProviderImpl(
154 &visitor_, 154 &visitor_,
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 267
268 // Verify that the downloader is attempting to download a CRX file. 268 // Verify that the downloader is attempting to download a CRX file.
269 fetcher = factory.GetFetcherByID( 269 fetcher = factory.GetFetcherByID(
270 extensions::ExtensionDownloader::kExtensionFetcherId); 270 extensions::ExtensionDownloader::kExtensionFetcherId);
271 ASSERT_TRUE(fetcher); 271 ASSERT_TRUE(fetcher);
272 ASSERT_TRUE(fetcher->delegate()); 272 ASSERT_TRUE(fetcher->delegate());
273 273
274 // Create a temporary CRX file and return its path to the downloader. 274 // Create a temporary CRX file and return its path to the downloader.
275 EXPECT_TRUE(base::CopyFile( 275 EXPECT_TRUE(base::CopyFile(
276 test_dir_.Append(kExtensionCRXSourceDir).Append(kExtensionCRXFile), 276 test_dir_.Append(kExtensionCRXSourceDir).Append(kExtensionCRXFile),
277 temp_dir_.path().Append(kExtensionCRXFile))); 277 temp_dir_.GetPath().Append(kExtensionCRXFile)));
278 fetcher->set_response_code(200); 278 fetcher->set_response_code(200);
279 fetcher->SetResponseFilePath(temp_dir_.path().Append(kExtensionCRXFile)); 279 fetcher->SetResponseFilePath(temp_dir_.GetPath().Append(kExtensionCRXFile));
280 fetcher->delegate()->OnURLFetchComplete(fetcher); 280 fetcher->delegate()->OnURLFetchComplete(fetcher);
281 281
282 // Spin the loop. Verify that the loader announces the presence of a new CRX 282 // Spin the loop. Verify that the loader announces the presence of a new CRX
283 // file, served from the cache directory. 283 // file, served from the cache directory.
284 const base::FilePath cached_crx_path = cache_dir_.Append(base::StringPrintf( 284 const base::FilePath cached_crx_path = cache_dir_.Append(base::StringPrintf(
285 "%s-%s.crx", kExtensionId, kExtensionCRXVersion)); 285 "%s-%s.crx", kExtensionId, kExtensionCRXVersion));
286 base::RunLoop cache_run_loop; 286 base::RunLoop cache_run_loop;
287 EXPECT_CALL( 287 EXPECT_CALL(
288 visitor_, 288 visitor_,
289 OnExternalExtensionFileFound(AllOf( 289 OnExternalExtensionFileFound(AllOf(
(...skipping 21 matching lines...) Expand all
311 loader_->StopCache(shutdown_run_loop.QuitClosure()); 311 loader_->StopCache(shutdown_run_loop.QuitClosure());
312 VerifyAndResetVisitorCallExpectations(); 312 VerifyAndResetVisitorCallExpectations();
313 313
314 // Spin the loop until the cache shutdown callback is invoked. Verify that at 314 // Spin the loop until the cache shutdown callback is invoked. Verify that at
315 // that point, no further file I/O tasks are pending. 315 // that point, no further file I/O tasks are pending.
316 shutdown_run_loop.Run(); 316 shutdown_run_loop.Run();
317 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting()); 317 EXPECT_TRUE(base::MessageLoop::current()->IsIdleForTesting());
318 } 318 }
319 319
320 } // namespace chromeos 320 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698