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 <wincrypt.h> | 6 #include <wincrypt.h> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
18 #include "base/time.h" | 18 #include "base/time.h" |
19 #include "chrome/browser/password_manager/ie7_password.h" | 19 #include "chrome/browser/password_manager/ie7_password.h" |
20 #include "chrome/browser/password_manager/password_form_data.h" | 20 #include "chrome/browser/password_manager/password_form_data.h" |
21 #include "chrome/browser/password_manager/password_store_consumer.h" | 21 #include "chrome/browser/password_manager/password_store_consumer.h" |
22 #include "chrome/browser/password_manager/password_store_win.h" | 22 #include "chrome/browser/password_manager/password_store_win.h" |
23 #include "chrome/browser/webdata/logins_table.h" | 23 #include "chrome/browser/webdata/logins_table.h" |
24 #include "chrome/browser/webdata/web_data_service.h" | 24 #include "chrome/browser/webdata/web_data_service.h" |
25 #include "chrome/browser/webdata/web_database_service.h" | 25 #include "chrome/browser/webdata/web_database_service.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
28 #include "components/autofill/browser/autofill_country.h" | |
29 #include "content/public/test/test_browser_thread.h" | 28 #include "content/public/test/test_browser_thread.h" |
30 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
31 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
32 | 31 |
33 using base::WaitableEvent; | 32 using base::WaitableEvent; |
34 using content::BrowserThread; | 33 using content::BrowserThread; |
35 using testing::_; | 34 using testing::_; |
36 using testing::DoAll; | 35 using testing::DoAll; |
37 using testing::WithArg; | 36 using testing::WithArg; |
38 using content::PasswordForm; | 37 using content::PasswordForm; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 virtual void SetUp() { | 110 virtual void SetUp() { |
112 ASSERT_TRUE(db_thread_.Start()); | 111 ASSERT_TRUE(db_thread_.Start()); |
113 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 112 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
114 | 113 |
115 profile_.reset(new TestingProfile()); | 114 profile_.reset(new TestingProfile()); |
116 | 115 |
117 login_db_.reset(new LoginDatabase()); | 116 login_db_.reset(new LoginDatabase()); |
118 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( | 117 ASSERT_TRUE(login_db_->Init(temp_dir_.path().Append( |
119 FILE_PATH_LITERAL("login_test")))); | 118 FILE_PATH_LITERAL("login_test")))); |
120 base::FilePath path = temp_dir_.path().AppendASCII("web_data_test"); | 119 base::FilePath path = temp_dir_.path().AppendASCII("web_data_test"); |
121 wdbs_ = new WebDatabaseService(path, AutofillCountry::ApplicationLocale()); | 120 wdbs_ = new WebDatabaseService(path); |
122 // Need to add at least one table so the database gets created. | 121 // Need to add at least one table so the database gets created. |
123 wdbs_->AddTable(scoped_ptr<WebDatabaseTable>(new LoginsTable())); | 122 wdbs_->AddTable(scoped_ptr<WebDatabaseTable>(new LoginsTable())); |
124 wdbs_->LoadDatabase(WebDatabaseService::InitCallback()); | 123 wdbs_->LoadDatabase(WebDatabaseService::InitCallback()); |
125 wds_ = new WebDataService(wdbs_, | 124 wds_ = new WebDataService(wdbs_, |
126 WebDataServiceBase::ProfileErrorCallback()); | 125 WebDataServiceBase::ProfileErrorCallback()); |
127 wds_->Init(); | 126 wds_->Init(); |
128 } | 127 } |
129 | 128 |
130 virtual void TearDown() { | 129 virtual void TearDown() { |
131 if (store_.get()) | 130 if (store_.get()) |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 VectorOfForms expect_none; | 418 VectorOfForms expect_none; |
420 // expect that we get no results; | 419 // expect that we get no results; |
421 EXPECT_CALL( | 420 EXPECT_CALL( |
422 consumer, | 421 consumer, |
423 OnPasswordStoreRequestDone(_, ContainsAllPasswordForms(expect_none))) | 422 OnPasswordStoreRequestDone(_, ContainsAllPasswordForms(expect_none))) |
424 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); | 423 .WillOnce(DoAll(WithArg<1>(STLDeleteElements0()), QuitUIMessageLoop())); |
425 | 424 |
426 store_->GetAutofillableLogins(&consumer); | 425 store_->GetAutofillableLogins(&consumer); |
427 MessageLoop::current()->Run(); | 426 MessageLoop::current()->Run(); |
428 } | 427 } |
OLD | NEW |