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

Side by Side Diff: components/password_manager/core/browser/password_store_default_unittest.cc

Issue 1144153004: components: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 base::MessageLoopForUI message_loop_; 92 base::MessageLoopForUI message_loop_;
93 base::ScopedTempDir temp_dir_; 93 base::ScopedTempDir temp_dir_;
94 }; 94 };
95 95
96 ACTION(STLDeleteElements0) { 96 ACTION(STLDeleteElements0) {
97 STLDeleteContainerPointers(arg0.begin(), arg0.end()); 97 STLDeleteContainerPointers(arg0.begin(), arg0.end());
98 } 98 }
99 99
100 TEST_F(PasswordStoreDefaultTest, NonASCIIData) { 100 TEST_F(PasswordStoreDefaultTest, NonASCIIData) {
101 scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault( 101 scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault(
102 base::MessageLoopProxy::current(), base::MessageLoopProxy::current(), 102 base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
103 make_scoped_ptr(new LoginDatabase(test_login_db_file_path())))); 103 make_scoped_ptr(new LoginDatabase(test_login_db_file_path()))));
104 store->Init(syncer::SyncableService::StartSyncFlare()); 104 store->Init(syncer::SyncableService::StartSyncFlare());
105 105
106 // Some non-ASCII password form data. 106 // Some non-ASCII password form data.
107 static const PasswordFormData form_data[] = { 107 static const PasswordFormData form_data[] = {
108 { PasswordForm::SCHEME_HTML, 108 { PasswordForm::SCHEME_HTML,
109 "http://foo.example.com", 109 "http://foo.example.com",
110 "http://foo.example.com/origin", 110 "http://foo.example.com/origin",
111 "http://foo.example.com/action", 111 "http://foo.example.com/action",
112 L"มีสีสัน", 112 L"มีสีสัน",
(...skipping 23 matching lines...) Expand all
136 store->GetAutofillableLogins(&consumer); 136 store->GetAutofillableLogins(&consumer);
137 137
138 base::MessageLoop::current()->RunUntilIdle(); 138 base::MessageLoop::current()->RunUntilIdle();
139 139
140 store->Shutdown(); 140 store->Shutdown();
141 base::MessageLoop::current()->RunUntilIdle(); 141 base::MessageLoop::current()->RunUntilIdle();
142 } 142 }
143 143
144 TEST_F(PasswordStoreDefaultTest, Notifications) { 144 TEST_F(PasswordStoreDefaultTest, Notifications) {
145 scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault( 145 scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault(
146 base::MessageLoopProxy::current(), base::MessageLoopProxy::current(), 146 base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
147 make_scoped_ptr(new LoginDatabase(test_login_db_file_path())))); 147 make_scoped_ptr(new LoginDatabase(test_login_db_file_path()))));
148 store->Init(syncer::SyncableService::StartSyncFlare()); 148 store->Init(syncer::SyncableService::StartSyncFlare());
149 149
150 scoped_ptr<PasswordForm> form = 150 scoped_ptr<PasswordForm> form =
151 CreatePasswordFormFromDataForTesting(CreateTestPasswordFormData()); 151 CreatePasswordFormFromDataForTesting(CreateTestPasswordFormData());
152 152
153 MockPasswordStoreObserver observer; 153 MockPasswordStoreObserver observer;
154 store->AddObserver(&observer); 154 store->AddObserver(&observer);
155 155
156 const PasswordStoreChange expected_add_changes[] = { 156 const PasswordStoreChange expected_add_changes[] = {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 store->RemoveObserver(&observer); 192 store->RemoveObserver(&observer);
193 store->Shutdown(); 193 store->Shutdown();
194 base::MessageLoop::current()->RunUntilIdle(); 194 base::MessageLoop::current()->RunUntilIdle();
195 } 195 }
196 196
197 // Verify that operations on a PasswordStore with a bad database cause no 197 // Verify that operations on a PasswordStore with a bad database cause no
198 // explosions, but fail without side effect, return no data and trigger no 198 // explosions, but fail without side effect, return no data and trigger no
199 // notifications. 199 // notifications.
200 TEST_F(PasswordStoreDefaultTest, OperationsOnABadDatabaseSilentlyFail) { 200 TEST_F(PasswordStoreDefaultTest, OperationsOnABadDatabaseSilentlyFail) {
201 scoped_refptr<PasswordStoreDefault> bad_store(new PasswordStoreDefault( 201 scoped_refptr<PasswordStoreDefault> bad_store(new PasswordStoreDefault(
202 base::MessageLoopProxy::current(), base::MessageLoopProxy::current(), 202 base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
203 make_scoped_ptr<LoginDatabase>(new BadLoginDatabase))); 203 make_scoped_ptr<LoginDatabase>(new BadLoginDatabase)));
204 204
205 bad_store->Init(syncer::SyncableService::StartSyncFlare()); 205 bad_store->Init(syncer::SyncableService::StartSyncFlare());
206 base::MessageLoop::current()->RunUntilIdle(); 206 base::MessageLoop::current()->RunUntilIdle();
207 ASSERT_EQ(nullptr, bad_store->login_db()); 207 ASSERT_EQ(nullptr, bad_store->login_db());
208 208
209 testing::StrictMock<MockPasswordStoreObserver> mock_observer; 209 testing::StrictMock<MockPasswordStoreObserver> mock_observer;
210 bad_store->AddObserver(&mock_observer); 210 bad_store->AddObserver(&mock_observer);
211 211
212 // Add a new autofillable login + a blacklisted login. 212 // Add a new autofillable login + a blacklisted login.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 bad_store->RemoveLoginsSyncedBetween(base::Time(), base::Time::Max()); 252 bad_store->RemoveLoginsSyncedBetween(base::Time(), base::Time::Max());
253 base::MessageLoop::current()->RunUntilIdle(); 253 base::MessageLoop::current()->RunUntilIdle();
254 254
255 // Ensure no notifications and no explosions during shutdown either. 255 // Ensure no notifications and no explosions during shutdown either.
256 bad_store->RemoveObserver(&mock_observer); 256 bad_store->RemoveObserver(&mock_observer);
257 bad_store->Shutdown(); 257 bad_store->Shutdown();
258 base::MessageLoop::current()->RunUntilIdle(); 258 base::MessageLoop::current()->RunUntilIdle();
259 } 259 }
260 260
261 } // namespace password_manager 261 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698