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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } else { | 222 } else { |
223 // When the password store is unavailable, password sync components must | 223 // When the password store is unavailable, password sync components must |
224 // not be created. | 224 // not be created. |
225 EXPECT_CALL(*components, CreatePasswordSyncComponents(_, _, _)) | 225 EXPECT_CALL(*components, CreatePasswordSyncComponents(_, _, _)) |
226 .Times(0); | 226 .Times(0); |
227 } | 227 } |
228 EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _, _)). | 228 EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _, _)). |
229 WillOnce(ReturnNewDataTypeManager()); | 229 WillOnce(ReturnNewDataTypeManager()); |
230 | 230 |
231 // We need tokens to get the tests going | 231 // We need tokens to get the tests going |
232 token_service_->IssueAuthTokenForTest( | 232 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()) |
233 GaiaConstants::kGaiaOAuth2LoginRefreshToken, "oauth2_login_token"); | 233 ->UpdateCredentials("test_user@gmail.com", "oauth2_login_token"); |
234 token_service_->IssueAuthTokenForTest( | 234 token_service_->IssueAuthTokenForTest(GaiaConstants::kSyncService, |
235 GaiaConstants::kSyncService, "token"); | 235 "token"); |
236 | 236 |
237 sync_service_->RegisterDataTypeController(data_type_controller); | 237 sync_service_->RegisterDataTypeController(data_type_controller); |
238 sync_service_->Initialize(); | 238 sync_service_->Initialize(); |
239 base::MessageLoop::current()->Run(); | 239 base::MessageLoop::current()->Run(); |
240 FlushLastDBTask(); | 240 FlushLastDBTask(); |
241 | 241 |
242 sync_service_->SetEncryptionPassphrase("foo", | 242 sync_service_->SetEncryptionPassphrase("foo", |
243 ProfileSyncService::IMPLICIT); | 243 ProfileSyncService::IMPLICIT); |
244 base::MessageLoop::current()->Run(); | 244 base::MessageLoop::current()->Run(); |
245 } | 245 } |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 CreateRootHelper create_root(this, syncer::PASSWORDS); | 648 CreateRootHelper create_root(this, syncer::PASSWORDS); |
649 StartSyncService(create_root.callback(), | 649 StartSyncService(create_root.callback(), |
650 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 650 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
651 | 651 |
652 std::vector<PasswordForm> new_sync_forms; | 652 std::vector<PasswordForm> new_sync_forms; |
653 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 653 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
654 | 654 |
655 EXPECT_EQ(1U, new_sync_forms.size()); | 655 EXPECT_EQ(1U, new_sync_forms.size()); |
656 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 656 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
657 } | 657 } |
OLD | NEW |