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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 static void SignalEvent(base::WaitableEvent* done) { | 158 static void SignalEvent(base::WaitableEvent* done) { |
159 done->Signal(); | 159 done->Signal(); |
160 } | 160 } |
161 | 161 |
162 void FlushLastDBTask() { | 162 void FlushLastDBTask() { |
163 base::WaitableEvent done(false, false); | 163 base::WaitableEvent done(false, false); |
164 BrowserThread::PostTask( | 164 BrowserThread::PostTask( |
165 BrowserThread::DB, FROM_HERE, | 165 BrowserThread::DB, FROM_HERE, |
166 base::Bind(&ProfileSyncServicePasswordTest::SignalEvent, &done)); | 166 base::Bind(&ProfileSyncServicePasswordTest::SignalEvent, &done)); |
167 done.TimedWait(base::TimeDelta::FromMilliseconds( | 167 done.TimedWait(TestTimeouts::action_timeout()); |
168 TestTimeouts::action_timeout_ms())); | |
169 } | 168 } |
170 | 169 |
171 void StartSyncService(const base::Closure& root_callback, | 170 void StartSyncService(const base::Closure& root_callback, |
172 const base::Closure& node_callback) { | 171 const base::Closure& node_callback) { |
173 if (!service_.get()) { | 172 if (!service_.get()) { |
174 SigninManager* signin = SigninManagerFactory::GetForProfile(&profile_); | 173 SigninManager* signin = SigninManagerFactory::GetForProfile(&profile_); |
175 signin->SetAuthenticatedUsername("test_user"); | 174 signin->SetAuthenticatedUsername("test_user"); |
176 token_service_ = static_cast<TokenService*>( | 175 token_service_ = static_cast<TokenService*>( |
177 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 176 TokenServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
178 &profile_, BuildTokenService)); | 177 &profile_, BuildTokenService)); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 CreateRootHelper create_root(this, syncer::PASSWORDS); | 565 CreateRootHelper create_root(this, syncer::PASSWORDS); |
567 StartSyncService(create_root.callback(), | 566 StartSyncService(create_root.callback(), |
568 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 567 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
569 | 568 |
570 std::vector<PasswordForm> new_sync_forms; | 569 std::vector<PasswordForm> new_sync_forms; |
571 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 570 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
572 | 571 |
573 EXPECT_EQ(1U, new_sync_forms.size()); | 572 EXPECT_EQ(1U, new_sync_forms.size()); |
574 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 573 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
575 } | 574 } |
OLD | NEW |