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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 static void QuitMessageLoop() { | 80 static void QuitMessageLoop() { |
81 MessageLoop::current()->Quit(); | 81 MessageLoop::current()->Quit(); |
82 } | 82 } |
83 | 83 |
84 class NullPasswordStore : public MockPasswordStore { | 84 class NullPasswordStore : public MockPasswordStore { |
85 public: | 85 public: |
86 NullPasswordStore() {} | 86 NullPasswordStore() {} |
87 | 87 |
88 static scoped_refptr<RefcountedProfileKeyedService> Build( | 88 static scoped_refptr<RefcountedBrowserContextKeyedService> Build( |
89 content::BrowserContext* profile) { | 89 content::BrowserContext* profile) { |
90 return scoped_refptr<RefcountedProfileKeyedService>(); | 90 return scoped_refptr<RefcountedBrowserContextKeyedService>(); |
91 } | 91 } |
92 | 92 |
93 protected: | 93 protected: |
94 virtual ~NullPasswordStore() {} | 94 virtual ~NullPasswordStore() {} |
95 }; | 95 }; |
96 | 96 |
97 class PasswordTestProfileSyncService : public TestProfileSyncService { | 97 class PasswordTestProfileSyncService : public TestProfileSyncService { |
98 public: | 98 public: |
99 PasswordTestProfileSyncService( | 99 PasswordTestProfileSyncService( |
100 ProfileSyncComponentsFactory* factory, | 100 ProfileSyncComponentsFactory* factory, |
(...skipping 21 matching lines...) Expand all Loading... |
122 if (!callback_.is_null()) | 122 if (!callback_.is_null()) |
123 callback_.Run(); | 123 callback_.Run(); |
124 | 124 |
125 TestProfileSyncService::OnPassphraseAccepted(); | 125 TestProfileSyncService::OnPassphraseAccepted(); |
126 } | 126 } |
127 | 127 |
128 virtual void OnConfigureBlocked() OVERRIDE { | 128 virtual void OnConfigureBlocked() OVERRIDE { |
129 QuitMessageLoop(); | 129 QuitMessageLoop(); |
130 } | 130 } |
131 | 131 |
132 static ProfileKeyedService* Build(content::BrowserContext* context) { | 132 static BrowserContextKeyedService* Build(content::BrowserContext* context) { |
133 Profile* profile = static_cast<Profile*>(context); | 133 Profile* profile = static_cast<Profile*>(context); |
134 SigninManagerBase* signin = | 134 SigninManagerBase* signin = |
135 SigninManagerFactory::GetForProfile(profile); | 135 SigninManagerFactory::GetForProfile(profile); |
136 ProfileSyncComponentsFactoryMock* factory = | 136 ProfileSyncComponentsFactoryMock* factory = |
137 new ProfileSyncComponentsFactoryMock(); | 137 new ProfileSyncComponentsFactoryMock(); |
138 return new PasswordTestProfileSyncService(factory, profile, signin); | 138 return new PasswordTestProfileSyncService(factory, profile, signin); |
139 } | 139 } |
140 | 140 |
141 void set_passphrase_accept_callback(const base::Closure& callback) { | 141 void set_passphrase_accept_callback(const base::Closure& callback) { |
142 callback_ = callback; | 142 callback_ = callback; |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 CreateRootHelper create_root(this, syncer::PASSWORDS); | 661 CreateRootHelper create_root(this, syncer::PASSWORDS); |
662 StartSyncService(create_root.callback(), | 662 StartSyncService(create_root.callback(), |
663 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); | 663 base::Bind(&AddPasswordEntriesCallback, this, sync_forms)); |
664 | 664 |
665 std::vector<PasswordForm> new_sync_forms; | 665 std::vector<PasswordForm> new_sync_forms; |
666 GetPasswordEntriesFromSyncDB(&new_sync_forms); | 666 GetPasswordEntriesFromSyncDB(&new_sync_forms); |
667 | 667 |
668 EXPECT_EQ(1U, new_sync_forms.size()); | 668 EXPECT_EQ(1U, new_sync_forms.size()); |
669 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); | 669 EXPECT_TRUE(ComparePasswords(expected_forms[0], new_sync_forms[0])); |
670 } | 670 } |
OLD | NEW |