OLD | NEW |
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/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 206 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
207 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 207 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
208 interceptor.SetResponseIgnoreQuery( | 208 interceptor.SetResponseIgnoreQuery( |
209 GURL("http://localhost/autoupdate/updates.xml"), | 209 GURL("http://localhost/autoupdate/updates.xml"), |
210 test_data_dir_.AppendASCII("permissions_increase") | 210 test_data_dir_.AppendASCII("permissions_increase") |
211 .AppendASCII("updates.xml")); | 211 .AppendASCII("updates.xml")); |
212 interceptor.SetResponseIgnoreQuery( | 212 interceptor.SetResponseIgnoreQuery( |
213 GURL("http://localhost/autoupdate/v2.crx"), | 213 GURL("http://localhost/autoupdate/v2.crx"), |
214 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); | 214 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); |
215 | 215 |
216 extensions::ExtensionUpdater::CheckParams params; | |
217 service_->updater()->set_default_check_params(params); | |
218 | |
219 extensions::TestExtensionRegistryObserver install_observer(registry_); | 216 extensions::TestExtensionRegistryObserver install_observer(registry_); |
220 sync_service->ProcessSyncChanges( | 217 sync_service->ProcessSyncChanges( |
221 FROM_HERE, | 218 FROM_HERE, |
222 syncer::SyncChangeList( | 219 syncer::SyncChangeList( |
223 1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD))); | 220 1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD))); |
224 | 221 |
225 install_observer.WaitForExtensionWillBeInstalled(); | 222 install_observer.WaitForExtensionWillBeInstalled(); |
226 content::RunAllBlockingPoolTasksUntilIdle(); | 223 content::RunAllBlockingPoolTasksUntilIdle(); |
227 | 224 |
228 extension = service_->GetExtensionById(extension_id, true); | 225 extension = service_->GetExtensionById(extension_id, true); |
(...skipping 16 matching lines...) Expand all Loading... |
245 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( | 242 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( |
246 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 243 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
247 interceptor.SetResponseIgnoreQuery( | 244 interceptor.SetResponseIgnoreQuery( |
248 GURL("http://localhost/autoupdate/updates.xml"), | 245 GURL("http://localhost/autoupdate/updates.xml"), |
249 test_data_dir_.AppendASCII("permissions_increase") | 246 test_data_dir_.AppendASCII("permissions_increase") |
250 .AppendASCII("updates.xml")); | 247 .AppendASCII("updates.xml")); |
251 interceptor.SetResponseIgnoreQuery( | 248 interceptor.SetResponseIgnoreQuery( |
252 GURL("http://localhost/autoupdate/v2.crx"), | 249 GURL("http://localhost/autoupdate/v2.crx"), |
253 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); | 250 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); |
254 | 251 |
255 extensions::ExtensionUpdater::CheckParams params; | |
256 service_->updater()->set_default_check_params(params); | |
257 | |
258 sync_pb::EntitySpecifics specifics; | 252 sync_pb::EntitySpecifics specifics; |
259 specifics.mutable_extension()->set_id(extension_id); | 253 specifics.mutable_extension()->set_id(extension_id); |
260 specifics.mutable_extension()->set_enabled(false); | 254 specifics.mutable_extension()->set_enabled(false); |
261 specifics.mutable_extension()->set_remote_install(true); | 255 specifics.mutable_extension()->set_remote_install(true); |
262 specifics.mutable_extension()->set_disable_reasons( | 256 specifics.mutable_extension()->set_disable_reasons( |
263 Extension::DISABLE_REMOTE_INSTALL); | 257 Extension::DISABLE_REMOTE_INSTALL); |
264 specifics.mutable_extension()->set_update_url( | 258 specifics.mutable_extension()->set_update_url( |
265 "http://localhost/autoupdate/updates.xml"); | 259 "http://localhost/autoupdate/updates.xml"); |
266 specifics.mutable_extension()->set_version("2"); | 260 specifics.mutable_extension()->set_version("2"); |
267 syncer::SyncData sync_data = | 261 syncer::SyncData sync_data = |
(...skipping 16 matching lines...) Expand all Loading... |
284 | 278 |
285 const Extension* extension = service_->GetExtensionById(extension_id, true); | 279 const Extension* extension = service_->GetExtensionById(extension_id, true); |
286 ASSERT_TRUE(extension); | 280 ASSERT_TRUE(extension); |
287 EXPECT_EQ("2", extension->VersionString()); | 281 EXPECT_EQ("2", extension->VersionString()); |
288 EXPECT_EQ(1u, registry_->disabled_extensions().size()); | 282 EXPECT_EQ(1u, registry_->disabled_extensions().size()); |
289 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, | 283 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, |
290 ExtensionPrefs::Get(service_->profile()) | 284 ExtensionPrefs::Get(service_->profile()) |
291 ->GetDisableReasons(extension_id)); | 285 ->GetDisableReasons(extension_id)); |
292 EXPECT_TRUE(GetExtensionDisabledGlobalError()); | 286 EXPECT_TRUE(GetExtensionDisabledGlobalError()); |
293 } | 287 } |
OLD | NEW |