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

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

Issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile Created 8 years, 8 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 true, false, 1, 259 true, false, 1,
256 }; 260 };
257 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); 261 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data));
258 262
259 MockPasswordStoreConsumer consumer; 263 MockPasswordStoreConsumer consumer;
260 store_->GetLogins(*form, &consumer); 264 store_->GetLogins(*form, &consumer);
261 265
262 // Release the PSW and the WDS before the query can return. 266 // Release the PSW and the WDS before the query can return.
263 store_->ShutdownOnUIThread(); 267 store_->ShutdownOnUIThread();
264 store_ = NULL; 268 store_ = NULL;
265 wds_->Shutdown();
266 wds_ = NULL; 269 wds_ = NULL;
267 270
268 MessageLoop::current()->RunAllPending(); 271 MessageLoop::current()->RunAllPending();
269 } 272 }
270 273
271 // Hangs flakily, see http://crbug.com/43836. 274 // Hangs flakily, see http://crbug.com/43836.
272 TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) { 275 TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) {
273 IE7PasswordInfo password_info; 276 IE7PasswordInfo password_info;
274 ASSERT_TRUE(CreateIE7PasswordInfo(L"http://example.com/origin", 277 ASSERT_TRUE(CreateIE7PasswordInfo(L"http://example.com/origin",
275 base::Time::FromDoubleT(1), 278 base::Time::FromDoubleT(1),
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 590
588 VectorOfForms expect_none; 591 VectorOfForms expect_none;
589 // expect that we get no results; 592 // expect that we get no results;
590 EXPECT_CALL(consumer, OnPasswordStoreRequestDone( 593 EXPECT_CALL(consumer, OnPasswordStoreRequestDone(
591 _, ContainsAllPasswordForms(expect_none))) 594 _, ContainsAllPasswordForms(expect_none)))
592 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); 595 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop()));
593 596
594 store_->GetAutofillableLogins(&consumer); 597 store_->GetAutofillableLogins(&consumer);
595 MessageLoop::current()->Run(); 598 MessageLoop::current()->Run();
596 } 599 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698