OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <stdarg.h> | 5 #include <stdarg.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/location.h" |
8 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/single_thread_task_runner.h" |
9 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/thread_task_runner_handle.h" |
14 #include "base/time/time.h" | 17 #include "base/time/time.h" |
15 #include "chrome/browser/password_manager/native_backend_libsecret.h" | 18 #include "chrome/browser/password_manager/native_backend_libsecret.h" |
16 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
17 #include "components/autofill/core/common/password_form.h" | 20 #include "components/autofill/core/common/password_form.h" |
18 #include "components/password_manager/core/browser/psl_matching_helper.h" | 21 #include "components/password_manager/core/browser/psl_matching_helper.h" |
19 #include "components/password_manager/core/common/password_manager_pref_names.h" | 22 #include "components/password_manager/core/common/password_manager_pref_names.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
21 | 24 |
22 using autofill::PasswordForm; | 25 using autofill::PasswordForm; |
23 using base::UTF8ToUTF16; | 26 using base::UTF8ToUTF16; |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 320 |
318 other_auth_.origin = GURL("http://www.example.com/"); | 321 other_auth_.origin = GURL("http://www.example.com/"); |
319 other_auth_.username_value = UTF8ToUTF16("username"); | 322 other_auth_.username_value = UTF8ToUTF16("username"); |
320 other_auth_.password_value = UTF8ToUTF16("pass"); | 323 other_auth_.password_value = UTF8ToUTF16("pass"); |
321 other_auth_.signon_realm = "http://www.example.com/Realm"; | 324 other_auth_.signon_realm = "http://www.example.com/Realm"; |
322 other_auth_.date_created = base::Time::Now(); | 325 other_auth_.date_created = base::Time::Now(); |
323 other_auth_.date_synced = base::Time::Now(); | 326 other_auth_.date_synced = base::Time::Now(); |
324 } | 327 } |
325 | 328 |
326 void TearDown() override { | 329 void TearDown() override { |
327 base::MessageLoop::current()->PostTask(FROM_HERE, | 330 base::ThreadTaskRunnerHandle::Get()->PostTask( |
328 base::MessageLoop::QuitClosure()); | 331 FROM_HERE, base::MessageLoop::QuitClosure()); |
329 base::MessageLoop::current()->Run(); | 332 base::MessageLoop::current()->Run(); |
330 ASSERT_TRUE(global_mock_libsecret_items); | 333 ASSERT_TRUE(global_mock_libsecret_items); |
331 global_mock_libsecret_items = nullptr; | 334 global_mock_libsecret_items = nullptr; |
332 } | 335 } |
333 | 336 |
334 void RunUIThread() { base::MessageLoop::current()->Run(); } | 337 void RunUIThread() { base::MessageLoop::current()->Run(); } |
335 | 338 |
336 void CheckUint32Attribute(const MockSecretItem* item, | 339 void CheckUint32Attribute(const MockSecretItem* item, |
337 const std::string& attribute, | 340 const std::string& attribute, |
338 uint32_t value) { | 341 uint32_t value) { |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 | 847 |
845 ScopedVector<autofill::PasswordForm> form_list; | 848 ScopedVector<autofill::PasswordForm> form_list; |
846 backend.GetAutofillableLogins(&form_list); | 849 backend.GetAutofillableLogins(&form_list); |
847 | 850 |
848 EXPECT_EQ(1u, form_list.size()); | 851 EXPECT_EQ(1u, form_list.size()); |
849 EXPECT_EQ(GURL(""), form_list[0]->avatar_url); | 852 EXPECT_EQ(GURL(""), form_list[0]->avatar_url); |
850 EXPECT_FALSE(form_list[0]->ssl_valid); | 853 EXPECT_FALSE(form_list[0]->ssl_valid); |
851 } | 854 } |
852 | 855 |
853 // TODO(mdm): add more basic tests here at some point. | 856 // TODO(mdm): add more basic tests here at some point. |
OLD | NEW |