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

Side by Side Diff: chrome/browser/extensions/extension_disabled_ui_browsertest.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 (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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 void SetUpOnMainThread() override { 56 void SetUpOnMainThread() override {
57 ExtensionBrowserTest::SetUpOnMainThread(); 57 ExtensionBrowserTest::SetUpOnMainThread();
58 EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir()); 58 EXPECT_TRUE(scoped_temp_dir_.CreateUniqueTempDir());
59 service_ = extensions::ExtensionSystem::Get(profile())->extension_service(); 59 service_ = extensions::ExtensionSystem::Get(profile())->extension_service();
60 registry_ = ExtensionRegistry::Get(profile()); 60 registry_ = ExtensionRegistry::Get(profile());
61 const base::FilePath test_dir = 61 const base::FilePath test_dir =
62 test_data_dir_.AppendASCII("permissions_increase"); 62 test_data_dir_.AppendASCII("permissions_increase");
63 const base::FilePath pem_path = test_dir.AppendASCII("permissions.pem"); 63 const base::FilePath pem_path = test_dir.AppendASCII("permissions.pem");
64 path_v1_ = PackExtensionWithOptions( 64 path_v1_ = PackExtensionWithOptions(
65 test_dir.AppendASCII("v1"), 65 test_dir.AppendASCII("v1"),
66 scoped_temp_dir_.path().AppendASCII("permissions1.crx"), 66 scoped_temp_dir_.GetPath().AppendASCII("permissions1.crx"), pem_path,
67 pem_path,
68 base::FilePath()); 67 base::FilePath());
69 path_v2_ = PackExtensionWithOptions( 68 path_v2_ = PackExtensionWithOptions(
70 test_dir.AppendASCII("v2"), 69 test_dir.AppendASCII("v2"),
71 scoped_temp_dir_.path().AppendASCII("permissions2.crx"), 70 scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx"), pem_path,
72 pem_path,
73 base::FilePath()); 71 base::FilePath());
74 path_v3_ = PackExtensionWithOptions( 72 path_v3_ = PackExtensionWithOptions(
75 test_dir.AppendASCII("v3"), 73 test_dir.AppendASCII("v3"),
76 scoped_temp_dir_.path().AppendASCII("permissions3.crx"), 74 scoped_temp_dir_.GetPath().AppendASCII("permissions3.crx"), pem_path,
77 pem_path,
78 base::FilePath()); 75 base::FilePath());
79 } 76 }
80 77
81 // Returns the ExtensionDisabledGlobalError, if present. 78 // Returns the ExtensionDisabledGlobalError, if present.
82 // Caution: currently only supports one error at a time. 79 // Caution: currently only supports one error at a time.
83 GlobalError* GetExtensionDisabledGlobalError() { 80 GlobalError* GetExtensionDisabledGlobalError() {
84 return GlobalErrorServiceFactory::GetForProfile(profile())-> 81 return GlobalErrorServiceFactory::GetForProfile(profile())->
85 GetGlobalErrorByMenuItemCommandID(IDC_EXTENSION_INSTALL_ERROR_FIRST); 82 GetGlobalErrorByMenuItemCommandID(IDC_EXTENSION_INSTALL_ERROR_FIRST);
86 } 83 }
87 84
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 net::LocalHostTestURLRequestInterceptor interceptor( 232 net::LocalHostTestURLRequestInterceptor interceptor(
236 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 233 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
237 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( 234 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
238 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 235 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
239 interceptor.SetResponseIgnoreQuery( 236 interceptor.SetResponseIgnoreQuery(
240 GURL("http://localhost/autoupdate/updates.xml"), 237 GURL("http://localhost/autoupdate/updates.xml"),
241 test_data_dir_.AppendASCII("permissions_increase") 238 test_data_dir_.AppendASCII("permissions_increase")
242 .AppendASCII("updates.xml")); 239 .AppendASCII("updates.xml"));
243 interceptor.SetResponseIgnoreQuery( 240 interceptor.SetResponseIgnoreQuery(
244 GURL("http://localhost/autoupdate/v2.crx"), 241 GURL("http://localhost/autoupdate/v2.crx"),
245 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); 242 scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx"));
246 243
247 sync_service->MergeDataAndStartSyncing( 244 sync_service->MergeDataAndStartSyncing(
248 syncer::EXTENSIONS, syncer::SyncDataList(), 245 syncer::EXTENSIONS, syncer::SyncDataList(),
249 base::WrapUnique(new syncer::FakeSyncChangeProcessor()), 246 base::WrapUnique(new syncer::FakeSyncChangeProcessor()),
250 base::WrapUnique(new syncer::SyncErrorFactoryMock())); 247 base::WrapUnique(new syncer::SyncErrorFactoryMock()));
251 extensions::TestExtensionRegistryObserver install_observer(registry_); 248 extensions::TestExtensionRegistryObserver install_observer(registry_);
252 sync_service->ProcessSyncChanges( 249 sync_service->ProcessSyncChanges(
253 FROM_HERE, 250 FROM_HERE,
254 syncer::SyncChangeList( 251 syncer::SyncChangeList(
255 1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD))); 252 1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD)));
(...skipping 19 matching lines...) Expand all
275 net::LocalHostTestURLRequestInterceptor interceptor( 272 net::LocalHostTestURLRequestInterceptor interceptor(
276 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), 273 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
277 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( 274 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
278 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 275 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
279 interceptor.SetResponseIgnoreQuery( 276 interceptor.SetResponseIgnoreQuery(
280 GURL("http://localhost/autoupdate/updates.xml"), 277 GURL("http://localhost/autoupdate/updates.xml"),
281 test_data_dir_.AppendASCII("permissions_increase") 278 test_data_dir_.AppendASCII("permissions_increase")
282 .AppendASCII("updates.xml")); 279 .AppendASCII("updates.xml"));
283 interceptor.SetResponseIgnoreQuery( 280 interceptor.SetResponseIgnoreQuery(
284 GURL("http://localhost/autoupdate/v2.crx"), 281 GURL("http://localhost/autoupdate/v2.crx"),
285 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); 282 scoped_temp_dir_.GetPath().AppendASCII("permissions2.crx"));
286 283
287 sync_pb::EntitySpecifics specifics; 284 sync_pb::EntitySpecifics specifics;
288 specifics.mutable_extension()->set_id(extension_id); 285 specifics.mutable_extension()->set_id(extension_id);
289 specifics.mutable_extension()->set_enabled(false); 286 specifics.mutable_extension()->set_enabled(false);
290 specifics.mutable_extension()->set_remote_install(true); 287 specifics.mutable_extension()->set_remote_install(true);
291 specifics.mutable_extension()->set_disable_reasons( 288 specifics.mutable_extension()->set_disable_reasons(
292 Extension::DISABLE_REMOTE_INSTALL); 289 Extension::DISABLE_REMOTE_INSTALL);
293 specifics.mutable_extension()->set_update_url( 290 specifics.mutable_extension()->set_update_url(
294 "http://localhost/autoupdate/updates.xml"); 291 "http://localhost/autoupdate/updates.xml");
295 specifics.mutable_extension()->set_version("2"); 292 specifics.mutable_extension()->set_version("2");
(...skipping 21 matching lines...) Expand all
317 314
318 const Extension* extension = service_->GetExtensionById(extension_id, true); 315 const Extension* extension = service_->GetExtensionById(extension_id, true);
319 ASSERT_TRUE(extension); 316 ASSERT_TRUE(extension);
320 EXPECT_EQ("2", extension->VersionString()); 317 EXPECT_EQ("2", extension->VersionString());
321 EXPECT_EQ(1u, registry_->disabled_extensions().size()); 318 EXPECT_EQ(1u, registry_->disabled_extensions().size());
322 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, 319 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL,
323 ExtensionPrefs::Get(service_->profile()) 320 ExtensionPrefs::Get(service_->profile())
324 ->GetDisableReasons(extension_id)); 321 ->GetDisableReasons(extension_id));
325 EXPECT_TRUE(GetExtensionDisabledGlobalError()); 322 EXPECT_TRUE(GetExtensionDisabledGlobalError());
326 } 323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698