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

Side by Side Diff: chrome/browser/extensions/settings/settings_apitest.cc

Issue 9414020: [Sync] Switch Extension Settings DTC to use ProfilesyncComponentsFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove RunWithSyncableService and clean up Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/settings/settings_frontend.h" 10 #include "chrome/browser/extensions/settings/settings_frontend.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 void FinalReplyWhenSatisfied( 63 void FinalReplyWhenSatisfied(
64 Namespace settings_namespace, 64 Namespace settings_namespace,
65 const std::string& normal_action, 65 const std::string& normal_action,
66 const std::string& incognito_action) { 66 const std::string& incognito_action) {
67 MaybeLoadAndReplyWhenSatisfied( 67 MaybeLoadAndReplyWhenSatisfied(
68 settings_namespace, normal_action, incognito_action, NULL, true); 68 settings_namespace, normal_action, incognito_action, NULL, true);
69 } 69 }
70 70
71 void InitSync(SyncChangeProcessor* sync_processor) { 71 void InitSync(SyncChangeProcessor* sync_processor) {
72 browser()->profile()->GetExtensionService()-> 72 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE,
73 settings_frontend()->RunWithSyncableService( 73 base::Bind(
74 &ExtensionSettingsApiTest::InitSyncWithSyncableService,
75 this,
76 sync_processor,
74 // TODO(kalman): test both EXTENSION_SETTINGS and APP_SETTINGS. 77 // TODO(kalman): test both EXTENSION_SETTINGS and APP_SETTINGS.
75 syncable::EXTENSION_SETTINGS, 78 browser()->profile()->GetExtensionService()->settings_frontend()->
76 base::Bind( 79 GetBackendForSync(syncable::EXTENSION_SETTINGS)));
not at google - send to devlin 2012/02/16 22:58:44 These tests all run on a single thread with the re
Nicolas Zea 2012/02/23 00:27:58 Done.
not at google - send to devlin 2012/02/23 02:15:38 .. so you do still need the MessageLoop stuff then
Nicolas Zea 2012/02/24 21:38:04 Yes, there's apparently other parts of the code th
77 &ExtensionSettingsApiTest::InitSyncWithSyncableService,
78 this,
79 sync_processor));
80 MessageLoop::current()->RunAllPending(); 80 MessageLoop::current()->RunAllPending();
81 } 81 }
82 82
83 void SendChanges(const SyncChangeList& change_list) { 83 void SendChanges(const SyncChangeList& change_list) {
84 browser()->profile()->GetExtensionService()-> 84 content::BrowserThread::PostTask(content::BrowserThread::FILE, FROM_HERE,
85 settings_frontend()->RunWithSyncableService( 85 base::Bind(
86 &ExtensionSettingsApiTest::SendChangesToSyncableService,
87 this,
88 change_list,
86 // TODO(kalman): test both EXTENSION_SETTINGS and APP_SETTINGS. 89 // TODO(kalman): test both EXTENSION_SETTINGS and APP_SETTINGS.
87 syncable::EXTENSION_SETTINGS, 90 browser()->profile()->GetExtensionService()->settings_frontend()->
88 base::Bind( 91 GetBackendForSync(syncable::EXTENSION_SETTINGS)));
89 &ExtensionSettingsApiTest::SendChangesToSyncableService,
90 this,
91 change_list));
92 MessageLoop::current()->RunAllPending(); 92 MessageLoop::current()->RunAllPending();
93 } 93 }
94 94
95 private: 95 private:
96 const Extension* MaybeLoadAndReplyWhenSatisfied( 96 const Extension* MaybeLoadAndReplyWhenSatisfied(
97 Namespace settings_namespace, 97 Namespace settings_namespace,
98 const std::string& normal_action, 98 const std::string& normal_action,
99 const std::string& incognito_action, 99 const std::string& incognito_action,
100 // May be NULL to imply not loading the extension. 100 // May be NULL to imply not loading the extension.
101 const std::string* extension_dir, 101 const std::string* extension_dir,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 SendChanges(sync_changes); 350 SendChanges(sync_changes);
351 351
352 FinalReplyWhenSatisfied(LOCAL, 352 FinalReplyWhenSatisfied(LOCAL,
353 "assertNoNotifications", "assertNoNotifications"); 353 "assertNoNotifications", "assertNoNotifications");
354 354
355 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 355 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
356 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); 356 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message();
357 } 357 }
358 358
359 } // namespace extensions 359 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698