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

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

Issue 1778923003: Fix extensions sync in cases where items change type (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review feedback Created 4 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service_sync_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 12 matching lines...) Expand all
23 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "content/public/test/test_utils.h" 24 #include "content/public/test/test_utils.h"
25 #include "extensions/browser/extension_dialog_auto_confirm.h" 25 #include "extensions/browser/extension_dialog_auto_confirm.h"
26 #include "extensions/browser/extension_prefs.h" 26 #include "extensions/browser/extension_prefs.h"
27 #include "extensions/browser/extension_registry.h" 27 #include "extensions/browser/extension_registry.h"
28 #include "extensions/browser/extension_system.h" 28 #include "extensions/browser/extension_system.h"
29 #include "extensions/browser/test_extension_registry_observer.h" 29 #include "extensions/browser/test_extension_registry_observer.h"
30 #include "extensions/common/extension.h" 30 #include "extensions/common/extension.h"
31 #include "extensions/test/extension_test_message_listener.h" 31 #include "extensions/test/extension_test_message_listener.h"
32 #include "net/url_request/test_url_request_interceptor.h" 32 #include "net/url_request/test_url_request_interceptor.h"
33 #include "sync/api/fake_sync_change_processor.h"
34 #include "sync/api/sync_error_factory_mock.h"
33 #include "sync/protocol/extension_specifics.pb.h" 35 #include "sync/protocol/extension_specifics.pb.h"
34 #include "sync/protocol/sync.pb.h" 36 #include "sync/protocol/sync.pb.h"
35 37
36 using content::BrowserThread; 38 using content::BrowserThread;
37 using extensions::Extension; 39 using extensions::Extension;
38 using extensions::ExtensionRegistry; 40 using extensions::ExtensionRegistry;
39 using extensions::ExtensionPrefs; 41 using extensions::ExtensionPrefs;
40 using extensions::ExtensionSyncData; 42 using extensions::ExtensionSyncData;
41 43
42 class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest { 44 class ExtensionDisabledGlobalErrorTest : public ExtensionBrowserTest {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior( 208 BrowserThread::GetBlockingPool()->GetTaskRunnerWithShutdownBehavior(
207 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 209 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
208 interceptor.SetResponseIgnoreQuery( 210 interceptor.SetResponseIgnoreQuery(
209 GURL("http://localhost/autoupdate/updates.xml"), 211 GURL("http://localhost/autoupdate/updates.xml"),
210 test_data_dir_.AppendASCII("permissions_increase") 212 test_data_dir_.AppendASCII("permissions_increase")
211 .AppendASCII("updates.xml")); 213 .AppendASCII("updates.xml"));
212 interceptor.SetResponseIgnoreQuery( 214 interceptor.SetResponseIgnoreQuery(
213 GURL("http://localhost/autoupdate/v2.crx"), 215 GURL("http://localhost/autoupdate/v2.crx"),
214 scoped_temp_dir_.path().AppendASCII("permissions2.crx")); 216 scoped_temp_dir_.path().AppendASCII("permissions2.crx"));
215 217
218 sync_service->MergeDataAndStartSyncing(
219 syncer::EXTENSIONS, syncer::SyncDataList(),
220 make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
221 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
216 extensions::TestExtensionRegistryObserver install_observer(registry_); 222 extensions::TestExtensionRegistryObserver install_observer(registry_);
217 sync_service->ProcessSyncChanges( 223 sync_service->ProcessSyncChanges(
218 FROM_HERE, 224 FROM_HERE,
219 syncer::SyncChangeList( 225 syncer::SyncChangeList(
220 1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD))); 226 1, sync_data.GetSyncChange(syncer::SyncChange::ACTION_ADD)));
221 227
222 install_observer.WaitForExtensionWillBeInstalled(); 228 install_observer.WaitForExtensionWillBeInstalled();
223 content::RunAllBlockingPoolTasksUntilIdle(); 229 content::RunAllBlockingPoolTasksUntilIdle();
224 230
225 extension = service_->GetExtensionById(extension_id, true); 231 extension = service_->GetExtensionById(extension_id, true);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 specifics.mutable_extension()->set_update_url( 264 specifics.mutable_extension()->set_update_url(
259 "http://localhost/autoupdate/updates.xml"); 265 "http://localhost/autoupdate/updates.xml");
260 specifics.mutable_extension()->set_version("2"); 266 specifics.mutable_extension()->set_version("2");
261 syncer::SyncData sync_data = 267 syncer::SyncData sync_data =
262 syncer::SyncData::CreateRemoteData(1234567, 268 syncer::SyncData::CreateRemoteData(1234567,
263 specifics, 269 specifics,
264 base::Time::Now(), 270 base::Time::Now(),
265 syncer::AttachmentIdList(), 271 syncer::AttachmentIdList(),
266 syncer::AttachmentServiceProxy()); 272 syncer::AttachmentServiceProxy());
267 273
274 ExtensionSyncService* sync_service = ExtensionSyncService::Get(profile());
275 sync_service->MergeDataAndStartSyncing(
276 syncer::EXTENSIONS, syncer::SyncDataList(),
277 make_scoped_ptr(new syncer::FakeSyncChangeProcessor()),
278 make_scoped_ptr(new syncer::SyncErrorFactoryMock()));
268 extensions::TestExtensionRegistryObserver install_observer(registry_); 279 extensions::TestExtensionRegistryObserver install_observer(registry_);
269 ExtensionSyncService::Get(profile())->ProcessSyncChanges( 280 sync_service->ProcessSyncChanges(
270 FROM_HERE, 281 FROM_HERE,
271 syncer::SyncChangeList( 282 syncer::SyncChangeList(
272 1, syncer::SyncChange(FROM_HERE, 283 1, syncer::SyncChange(FROM_HERE, syncer::SyncChange::ACTION_ADD,
273 syncer::SyncChange::ACTION_ADD,
274 sync_data))); 284 sync_data)));
275 285
276 install_observer.WaitForExtensionWillBeInstalled(); 286 install_observer.WaitForExtensionWillBeInstalled();
277 content::RunAllBlockingPoolTasksUntilIdle(); 287 content::RunAllBlockingPoolTasksUntilIdle();
278 288
279 const Extension* extension = service_->GetExtensionById(extension_id, true); 289 const Extension* extension = service_->GetExtensionById(extension_id, true);
280 ASSERT_TRUE(extension); 290 ASSERT_TRUE(extension);
281 EXPECT_EQ("2", extension->VersionString()); 291 EXPECT_EQ("2", extension->VersionString());
282 EXPECT_EQ(1u, registry_->disabled_extensions().size()); 292 EXPECT_EQ(1u, registry_->disabled_extensions().size());
283 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL, 293 EXPECT_EQ(Extension::DISABLE_REMOTE_INSTALL,
284 ExtensionPrefs::Get(service_->profile()) 294 ExtensionPrefs::Get(service_->profile())
285 ->GetDisableReasons(extension_id)); 295 ->GetDisableReasons(extension_id));
286 EXPECT_TRUE(GetExtensionDisabledGlobalError()); 296 EXPECT_TRUE(GetExtensionDisabledGlobalError());
287 } 297 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service_sync_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698