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

Side by Side Diff: chrome/browser/password_manager/password_store_win_unittest.cc

Issue 10185008: Taking over issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 <windows.h> 5 #include <windows.h>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 #include <wincrypt.h> 8 #include <wincrypt.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( 113 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append(
114 FILE_PATH_LITERAL("login_test")))); 114 FILE_PATH_LITERAL("login_test"))));
115 115
116 wds_ = new WebDataService(); 116 wds_ = new WebDataService();
117 ASSERT_TRUE(wds_->Init(temp_dir_.path())); 117 ASSERT_TRUE(wds_->Init(temp_dir_.path()));
118 } 118 }
119 119
120 virtual void TearDown() { 120 virtual void TearDown() {
121 if (store_.get()) 121 if (store_.get())
122 store_->ShutdownOnUIThread(); 122 store_->ShutdownOnUIThread();
123 if (wds_.get()) 123 wds_->ShutdownOnUIThread();
124 wds_->Shutdown(); 124 wds_ = NULL;
125 base::WaitableEvent done(false, false);
126 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
127 base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done)));
128 done.Wait();
125 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); 129 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure());
126 MessageLoop::current()->Run(); 130 MessageLoop::current()->Run();
127 db_thread_.Stop(); 131 db_thread_.Stop();
128 } 132 }
129 133
130 MessageLoopForUI message_loop_; 134 MessageLoopForUI message_loop_;
131 content::TestBrowserThread ui_thread_; 135 content::TestBrowserThread ui_thread_;
132 // PasswordStore, WDS schedule work on this thread. 136 // PasswordStore, WDS schedule work on this thread.
133 content::TestBrowserThread db_thread_; 137 content::TestBrowserThread db_thread_;
134 138
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 true, false, 1, 247 true, false, 1,
244 }; 248 };
245 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); 249 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data));
246 250
247 MockPasswordStoreConsumer consumer; 251 MockPasswordStoreConsumer consumer;
248 store_->GetLogins(*form, &consumer); 252 store_->GetLogins(*form, &consumer);
249 253
250 // Release the PSW and the WDS before the query can return. 254 // Release the PSW and the WDS before the query can return.
251 store_->ShutdownOnUIThread(); 255 store_->ShutdownOnUIThread();
252 store_ = NULL; 256 store_ = NULL;
253 wds_->Shutdown();
254 wds_ = NULL; 257 wds_ = NULL;
255 258
256 MessageLoop::current()->RunAllPending(); 259 MessageLoop::current()->RunAllPending();
257 } 260 }
258 261
259 // Hangs flakily, see http://crbug.com/43836. 262 // Hangs flakily, see http://crbug.com/43836.
260 TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) { 263 TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) {
261 IE7PasswordInfo password_info; 264 IE7PasswordInfo password_info;
262 ASSERT_TRUE(CreateIE7PasswordInfo(L"http://example.com/origin", 265 ASSERT_TRUE(CreateIE7PasswordInfo(L"http://example.com/origin",
263 base::Time::FromDoubleT(1), 266 base::Time::FromDoubleT(1),
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 406
404 VectorOfForms expect_none; 407 VectorOfForms expect_none;
405 // expect that we get no results; 408 // expect that we get no results;
406 EXPECT_CALL(consumer, OnPasswordStoreRequestDone( 409 EXPECT_CALL(consumer, OnPasswordStoreRequestDone(
407 _, ContainsAllPasswordForms(expect_none))) 410 _, ContainsAllPasswordForms(expect_none)))
408 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); 411 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop()));
409 412
410 store_->GetAutofillableLogins(&consumer); 413 store_->GetAutofillableLogins(&consumer);
411 MessageLoop::current()->Run(); 414 MessageLoop::current()->Run();
412 } 415 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_factory.cc ('k') | chrome/browser/profiles/off_the_record_profile_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698