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

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

Issue 12033093: sync: Implementation of Priority Preferences. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Attempting to parametrize the PSS pref test fixture to also test priority prefs. Created 7 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 | Annotate | Revision Log
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 "chrome/browser/sync/abstract_profile_sync_service_test.h" 5 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "chrome/browser/sync/test_profile_sync_service.h" 10 #include "chrome/browser/sync/test_profile_sync_service.h"
(...skipping 22 matching lines...) Expand all
33 ProfileSyncServiceTestHelper::MakeSingletonDeletionChangeRecordList( 33 ProfileSyncServiceTestHelper::MakeSingletonDeletionChangeRecordList(
34 int64 node_id, const sync_pb::EntitySpecifics& specifics) { 34 int64 node_id, const sync_pb::EntitySpecifics& specifics) {
35 syncer::ChangeRecord record; 35 syncer::ChangeRecord record;
36 record.action = syncer::ChangeRecord::ACTION_DELETE; 36 record.action = syncer::ChangeRecord::ACTION_DELETE;
37 record.id = node_id; 37 record.id = node_id;
38 record.specifics = specifics; 38 record.specifics = specifics;
39 syncer::ChangeRecordList records(1, record); 39 syncer::ChangeRecordList records(1, record);
40 return syncer::ImmutableChangeRecordList(&records); 40 return syncer::ImmutableChangeRecordList(&records);
41 } 41 }
42 42
43 AbstractProfileSyncServiceTest::AbstractProfileSyncServiceTest() 43 BaseProfileSyncServiceTest::BaseProfileSyncServiceTest()
44 : ui_thread_(BrowserThread::UI, &ui_loop_), 44 : ui_thread_(BrowserThread::UI, &ui_loop_),
45 db_thread_(BrowserThread::DB), 45 db_thread_(BrowserThread::DB),
46 file_thread_(BrowserThread::FILE), 46 file_thread_(BrowserThread::FILE),
47 io_thread_(BrowserThread::IO), 47 io_thread_(BrowserThread::IO),
48 token_service_(NULL), 48 token_service_(NULL),
49 sync_service_(NULL) { 49 sync_service_(NULL) {
50 } 50 }
51 51
52 AbstractProfileSyncServiceTest::~AbstractProfileSyncServiceTest() {} 52 BaseProfileSyncServiceTest::~BaseProfileSyncServiceTest() {}
53 53
54 void AbstractProfileSyncServiceTest::SetUp() { 54 void BaseProfileSyncServiceTest::SetUp() {
55 db_thread_.Start(); 55 db_thread_.Start();
56 file_thread_.Start(); 56 file_thread_.Start();
57 io_thread_.StartIOThread(); 57 io_thread_.StartIOThread();
58 } 58 }
59 59
60 void AbstractProfileSyncServiceTest::TearDown() { 60 void BaseProfileSyncServiceTest::TearDown() {
61 // Pump messages posted by the sync core thread (which may end up 61 // Pump messages posted by the sync core thread (which may end up
62 // posting on the IO thread). 62 // posting on the IO thread).
63 ui_loop_.RunUntilIdle(); 63 ui_loop_.RunUntilIdle();
64 io_thread_.Stop(); 64 io_thread_.Stop();
65 file_thread_.Stop(); 65 file_thread_.Stop();
66 db_thread_.Stop(); 66 db_thread_.Stop();
67 ui_loop_.RunUntilIdle(); 67 ui_loop_.RunUntilIdle();
68 } 68 }
69 69
70 bool AbstractProfileSyncServiceTest::CreateRoot(ModelType model_type) { 70 bool BaseProfileSyncServiceTest::CreateRoot(ModelType model_type) {
71 return syncer::TestUserShare::CreateRoot(model_type, 71 return syncer::TestUserShare::CreateRoot(model_type,
72 sync_service_->GetUserShare()); 72 sync_service_->GetUserShare());
73 } 73 }
74 74
75 // static 75 // static
76 ProfileKeyedService* AbstractProfileSyncServiceTest::BuildTokenService( 76 ProfileKeyedService* BaseProfileSyncServiceTest::BuildTokenService(
77 Profile* profile) { 77 Profile* profile) {
78 return new TokenService; 78 return new TokenService;
79 } 79 }
80 80
81 CreateRootHelper::CreateRootHelper(AbstractProfileSyncServiceTest* test, 81 AbstractProfileSyncServiceTest::AbstractProfileSyncServiceTest()
82 : BaseProfileSyncServiceTest() {}
83
84 AbstractProfileSyncServiceTest::~AbstractProfileSyncServiceTest() {}
85
86 void AbstractProfileSyncServiceTest::SetUp() {
87 BaseProfileSyncServiceTest::SetUp();
88 }
89
90 void AbstractProfileSyncServiceTest::TearDown() {
91 BaseProfileSyncServiceTest::TearDown();
92 }
93
94 CreateRootHelper::CreateRootHelper(BaseProfileSyncServiceTest* test,
82 ModelType model_type) 95 ModelType model_type)
83 : ALLOW_THIS_IN_INITIALIZER_LIST(callback_( 96 : ALLOW_THIS_IN_INITIALIZER_LIST(callback_(
84 base::Bind(&CreateRootHelper::CreateRootCallback, 97 base::Bind(&CreateRootHelper::CreateRootCallback,
85 base::Unretained(this)))), 98 base::Unretained(this)))),
86 test_(test), 99 test_(test),
87 model_type_(model_type), 100 model_type_(model_type),
88 success_(false) { 101 success_(false) {
89 } 102 }
90 103
91 CreateRootHelper::~CreateRootHelper() { 104 CreateRootHelper::~CreateRootHelper() {
92 } 105 }
93 106
94 const base::Closure& CreateRootHelper::callback() const { 107 const base::Closure& CreateRootHelper::callback() const {
95 return callback_; 108 return callback_;
96 } 109 }
97 110
98 bool CreateRootHelper::success() { 111 bool CreateRootHelper::success() {
99 return success_; 112 return success_;
100 } 113 }
101 114
102 void CreateRootHelper::CreateRootCallback() { 115 void CreateRootHelper::CreateRootCallback() {
103 success_ = test_->CreateRoot(model_type_); 116 success_ = test_->CreateRoot(model_type_);
104 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698