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

Side by Side Diff: chrome/browser/sync/abstract_profile_sync_service_test.h

Issue 3305003: New authorization framework for sync. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_ 5 #ifndef CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_
6 #define CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_ 6 #define CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/task.h" 13 #include "base/task.h"
14 #include "chrome/browser/chrome_thread.h" 14 #include "chrome/browser/chrome_thread.h"
15 #include "chrome/browser/net/gaia/token_service.h"
15 #include "chrome/browser/sync/engine/syncapi.h" 16 #include "chrome/browser/sync/engine/syncapi.h"
16 #include "chrome/browser/sync/glue/autofill_model_associator.h" 17 #include "chrome/browser/sync/glue/autofill_model_associator.h"
17 #include "chrome/browser/sync/glue/password_model_associator.h" 18 #include "chrome/browser/sync/glue/password_model_associator.h"
18 #include "chrome/browser/sync/glue/preference_model_associator.h" 19 #include "chrome/browser/sync/glue/preference_model_associator.h"
19 #include "chrome/browser/sync/glue/session_model_associator.h" 20 #include "chrome/browser/sync/glue/session_model_associator.h"
20 #include "chrome/browser/sync/glue/typed_url_model_associator.h" 21 #include "chrome/browser/sync/glue/typed_url_model_associator.h"
21 #include "chrome/browser/sync/profile_sync_factory_mock.h" 22 #include "chrome/browser/sync/profile_sync_factory_mock.h"
22 #include "chrome/browser/sync/protocol/sync.pb.h" 23 #include "chrome/browser/sync/protocol/sync.pb.h"
23 #include "chrome/browser/sync/syncable/directory_manager.h" 24 #include "chrome/browser/sync/syncable/directory_manager.h"
24 #include "chrome/browser/sync/syncable/model_type.h" 25 #include "chrome/browser/sync/syncable/model_type.h"
(...skipping 23 matching lines...) Expand all
48 using syncable::UNITTEST; 49 using syncable::UNITTEST;
49 using syncable::WriteTransaction; 50 using syncable::WriteTransaction;
50 51
51 class ProfileSyncServiceTestHelper { 52 class ProfileSyncServiceTestHelper {
52 public: 53 public:
53 static bool CreateRoot(ModelType model_type, ProfileSyncService* service, 54 static bool CreateRoot(ModelType model_type, ProfileSyncService* service,
54 TestIdFactory* ids) { 55 TestIdFactory* ids) {
55 UserShare* user_share = service->backend()->GetUserShareHandle(); 56 UserShare* user_share = service->backend()->GetUserShareHandle();
56 DirectoryManager* dir_manager = user_share->dir_manager.get(); 57 DirectoryManager* dir_manager = user_share->dir_manager.get();
57 58
58 ScopedDirLookup dir(dir_manager, user_share->authenticated_name); 59 ScopedDirLookup dir(dir_manager, user_share->name);
59 if (!dir.good()) 60 if (!dir.good())
60 return false; 61 return false;
61 62
62 std::string tag_name; 63 std::string tag_name;
63 switch (model_type) { 64 switch (model_type) {
64 case syncable::AUTOFILL: 65 case syncable::AUTOFILL:
65 tag_name = browser_sync::kAutofillTag; 66 tag_name = browser_sync::kAutofillTag;
66 break; 67 break;
67 case syncable::PREFERENCES: 68 case syncable::PREFERENCES:
68 tag_name = browser_sync::kPreferencesTag; 69 tag_name = browser_sync::kPreferencesTag;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 bool CreateRoot(ModelType model_type) { 114 bool CreateRoot(ModelType model_type) {
114 return ProfileSyncServiceTestHelper::CreateRoot(model_type, 115 return ProfileSyncServiceTestHelper::CreateRoot(model_type,
115 service_.get(), &ids_); 116 service_.get(), &ids_);
116 } 117 }
117 118
118 protected: 119 protected:
119 120
120 MessageLoopForUI message_loop_; 121 MessageLoopForUI message_loop_;
121 ChromeThread ui_thread_; 122 ChromeThread ui_thread_;
122 ProfileSyncFactoryMock factory_; 123 ProfileSyncFactoryMock factory_;
124 TokenService token_service_;
123 scoped_ptr<TestProfileSyncService> service_; 125 scoped_ptr<TestProfileSyncService> service_;
124 TestIdFactory ids_; 126 TestIdFactory ids_;
125 }; 127 };
126 128
127 class CreateRootTask : public Task { 129 class CreateRootTask : public Task {
128 public: 130 public:
129 CreateRootTask(AbstractProfileSyncServiceTest* test, ModelType model_type) 131 CreateRootTask(AbstractProfileSyncServiceTest* test, ModelType model_type)
130 : test_(test), model_type_(model_type), success_(false) { 132 : test_(test), model_type_(model_type), success_(false) {
131 } 133 }
132 134
133 virtual ~CreateRootTask() {} 135 virtual ~CreateRootTask() {}
134 virtual void Run() { 136 virtual void Run() {
135 success_ = test_->CreateRoot(model_type_); 137 success_ = test_->CreateRoot(model_type_);
136 } 138 }
137 139
138 bool success() { return success_; } 140 bool success() { return success_; }
139 141
140 private: 142 private:
141 AbstractProfileSyncServiceTest* test_; 143 AbstractProfileSyncServiceTest* test_;
142 ModelType model_type_; 144 ModelType model_type_;
143 bool success_; 145 bool success_;
144 }; 146 };
145 147
146 #endif // CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_ 148 #endif // CHROME_BROWSER_SYNC_ABSTRACT_PROFILE_SYNC_SERVICE_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698