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 <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 Loading... |
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_ = NULL; |
124 wds_->Shutdown(); | |
125 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 124 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
126 MessageLoop::current()->Run(); | 125 MessageLoop::current()->Run(); |
127 db_thread_.Stop(); | 126 db_thread_.Stop(); |
128 } | 127 } |
129 | 128 |
130 MessageLoopForUI message_loop_; | 129 MessageLoopForUI message_loop_; |
131 content::TestBrowserThread ui_thread_; | 130 content::TestBrowserThread ui_thread_; |
132 // PasswordStore, WDS schedule work on this thread. | 131 // PasswordStore, WDS schedule work on this thread. |
133 content::TestBrowserThread db_thread_; | 132 content::TestBrowserThread db_thread_; |
134 | 133 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 true, false, 1, | 254 true, false, 1, |
256 }; | 255 }; |
257 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); | 256 scoped_ptr<PasswordForm> form(CreatePasswordFormFromData(form_data)); |
258 | 257 |
259 MockPasswordStoreConsumer consumer; | 258 MockPasswordStoreConsumer consumer; |
260 store_->GetLogins(*form, &consumer); | 259 store_->GetLogins(*form, &consumer); |
261 | 260 |
262 // Release the PSW and the WDS before the query can return. | 261 // Release the PSW and the WDS before the query can return. |
263 store_->ShutdownOnUIThread(); | 262 store_->ShutdownOnUIThread(); |
264 store_ = NULL; | 263 store_ = NULL; |
265 wds_->Shutdown(); | |
266 wds_ = NULL; | 264 wds_ = NULL; |
267 | 265 |
268 MessageLoop::current()->RunAllPending(); | 266 MessageLoop::current()->RunAllPending(); |
269 } | 267 } |
270 | 268 |
271 // Hangs flakily, see http://crbug.com/43836. | 269 // Hangs flakily, see http://crbug.com/43836. |
272 TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) { | 270 TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) { |
273 IE7PasswordInfo password_info; | 271 IE7PasswordInfo password_info; |
274 ASSERT_TRUE(CreateIE7PasswordInfo(L"http://example.com/origin", | 272 ASSERT_TRUE(CreateIE7PasswordInfo(L"http://example.com/origin", |
275 base::Time::FromDoubleT(1), | 273 base::Time::FromDoubleT(1), |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 585 |
588 VectorOfForms expect_none; | 586 VectorOfForms expect_none; |
589 // expect that we get no results; | 587 // expect that we get no results; |
590 EXPECT_CALL(consumer, OnPasswordStoreRequestDone( | 588 EXPECT_CALL(consumer, OnPasswordStoreRequestDone( |
591 _, ContainsAllPasswordForms(expect_none))) | 589 _, ContainsAllPasswordForms(expect_none))) |
592 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); | 590 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); |
593 | 591 |
594 store_->GetAutofillableLogins(&consumer); | 592 store_->GetAutofillableLogins(&consumer); |
595 MessageLoop::current()->Run(); | 593 MessageLoop::current()->Run(); |
596 } | 594 } |
OLD | NEW |