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 // The passwords in the tests below are all empty because PasswordStoreDefault | 5 // The passwords in the tests below are all empty because PasswordStoreDefault |
6 // does not store the actual passwords on OS X (they are stored in the Keychain | 6 // does not store the actual passwords on OS X (they are stored in the Keychain |
7 // instead). We could special-case it, but it is easier to just have empty | 7 // instead). We could special-case it, but it is easier to just have empty |
8 // passwords. This will not be needed anymore if crbug.com/466638 is fixed. | 8 // passwords. This will not be needed anymore if crbug.com/466638 is fixed. |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "components/password_manager/core/browser/affiliated_match_helper.h" | 25 #include "components/password_manager/core/browser/affiliated_match_helper.h" |
26 #include "components/password_manager/core/browser/affiliation_service.h" | 26 #include "components/password_manager/core/browser/affiliation_service.h" |
27 #include "components/password_manager/core/browser/mock_affiliated_match_helper. h" | 27 #include "components/password_manager/core/browser/mock_affiliated_match_helper. h" |
28 #include "components/password_manager/core/browser/password_manager_test_utils.h " | 28 #include "components/password_manager/core/browser/password_manager_test_utils.h " |
29 #include "components/password_manager/core/browser/password_store_consumer.h" | 29 #include "components/password_manager/core/browser/password_store_consumer.h" |
30 #include "components/password_manager/core/browser/password_store_default.h" | 30 #include "components/password_manager/core/browser/password_store_default.h" |
31 #include "testing/gmock/include/gmock/gmock.h" | 31 #include "testing/gmock/include/gmock/gmock.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 | 33 |
34 #if defined(OS_MACOSX) | 34 #if defined(OS_MACOSX) |
35 #include "base/test/scoped_task_environment.h" | |
gab
2017/04/28 01:43:00
Wrong include block
fdoray
2017/05/01 17:16:51
Done.
| |
35 #include "components/os_crypt/os_crypt_mocker.h" | 36 #include "components/os_crypt/os_crypt_mocker.h" |
36 #endif | 37 #endif |
37 | 38 |
38 using autofill::PasswordForm; | 39 using autofill::PasswordForm; |
39 using base::WaitableEvent; | 40 using base::WaitableEvent; |
40 using testing::_; | 41 using testing::_; |
41 using testing::DoAll; | 42 using testing::DoAll; |
42 using testing::WithArg; | 43 using testing::WithArg; |
43 | 44 |
44 namespace password_manager { | 45 namespace password_manager { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 StartSyncFlareMock() {} | 83 StartSyncFlareMock() {} |
83 ~StartSyncFlareMock() {} | 84 ~StartSyncFlareMock() {} |
84 | 85 |
85 MOCK_METHOD1(StartSyncFlare, void(syncer::ModelType)); | 86 MOCK_METHOD1(StartSyncFlare, void(syncer::ModelType)); |
86 }; | 87 }; |
87 | 88 |
88 } // namespace | 89 } // namespace |
89 | 90 |
90 class PasswordStoreTest : public testing::Test { | 91 class PasswordStoreTest : public testing::Test { |
91 protected: | 92 protected: |
93 PasswordStoreTest() | |
94 : scoped_task_environment_( | |
95 base::test::ScopedTaskEnvironment::MainThreadType::UI) {} | |
96 | |
92 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } | 97 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } |
93 | 98 |
94 void TearDown() override { ASSERT_TRUE(temp_dir_.Delete()); } | 99 void TearDown() override { ASSERT_TRUE(temp_dir_.Delete()); } |
95 | 100 |
96 base::FilePath test_login_db_file_path() const { | 101 base::FilePath test_login_db_file_path() const { |
97 return temp_dir_.GetPath().Append(FILE_PATH_LITERAL("login_test")); | 102 return temp_dir_.GetPath().Append(FILE_PATH_LITERAL("login_test")); |
98 } | 103 } |
99 | 104 |
100 base::MessageLoopForUI message_loop_; | 105 base::test::ScopedTaskEnvironment scoped_task_environment_; |
101 base::ScopedTempDir temp_dir_; | 106 base::ScopedTempDir temp_dir_; |
102 }; | 107 }; |
103 | 108 |
104 TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) { | 109 TEST_F(PasswordStoreTest, IgnoreOldWwwGoogleLogins) { |
105 scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault( | 110 scoped_refptr<PasswordStoreDefault> store(new PasswordStoreDefault( |
106 base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(), | 111 base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(), |
107 base::MakeUnique<LoginDatabase>(test_login_db_file_path()))); | 112 base::MakeUnique<LoginDatabase>(test_login_db_file_path()))); |
108 store->Init(syncer::SyncableService::StartSyncFlare()); | 113 store->Init(syncer::SyncableService::StartSyncFlare()); |
109 | 114 |
110 const time_t cutoff = 1325376000; // 00:00 Jan 1 2012 UTC | 115 const time_t cutoff = 1325376000; // 00:00 Jan 1 2012 UTC |
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
897 | 902 |
898 store->ShutdownOnUIThread(); | 903 store->ShutdownOnUIThread(); |
899 base::RunLoop().RunUntilIdle(); | 904 base::RunLoop().RunUntilIdle(); |
900 #if defined(OS_MACOSX) | 905 #if defined(OS_MACOSX) |
901 OSCryptMocker::TearDown(); | 906 OSCryptMocker::TearDown(); |
902 #endif | 907 #endif |
903 } | 908 } |
904 #endif | 909 #endif |
905 | 910 |
906 } // namespace password_manager | 911 } // namespace password_manager |
OLD | NEW |