| 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 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 16 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| 18 #include "chrome/browser/password_manager/native_backend_libsecret.h" | 19 #include "chrome/browser/password_manager/native_backend_libsecret.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 other_auth_.username_value = UTF8ToUTF16("username"); | 332 other_auth_.username_value = UTF8ToUTF16("username"); |
| 332 other_auth_.password_value = UTF8ToUTF16("pass"); | 333 other_auth_.password_value = UTF8ToUTF16("pass"); |
| 333 other_auth_.signon_realm = "http://www.example.com/Realm"; | 334 other_auth_.signon_realm = "http://www.example.com/Realm"; |
| 334 other_auth_.date_created = base::Time::Now(); | 335 other_auth_.date_created = base::Time::Now(); |
| 335 other_auth_.date_synced = base::Time::Now(); | 336 other_auth_.date_synced = base::Time::Now(); |
| 336 } | 337 } |
| 337 | 338 |
| 338 void TearDown() override { | 339 void TearDown() override { |
| 339 base::ThreadTaskRunnerHandle::Get()->PostTask( | 340 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 340 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 341 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 341 base::MessageLoop::current()->Run(); | 342 base::RunLoop().Run(); |
| 342 ASSERT_TRUE(global_mock_libsecret_items); | 343 ASSERT_TRUE(global_mock_libsecret_items); |
| 343 global_mock_libsecret_items = nullptr; | 344 global_mock_libsecret_items = nullptr; |
| 344 } | 345 } |
| 345 | 346 |
| 346 void RunUIThread() { base::MessageLoop::current()->Run(); } | 347 void RunUIThread() { base::RunLoop().Run(); } |
| 347 | 348 |
| 348 void CheckUint32Attribute(const MockSecretItem* item, | 349 void CheckUint32Attribute(const MockSecretItem* item, |
| 349 const std::string& attribute, | 350 const std::string& attribute, |
| 350 uint32_t value) { | 351 uint32_t value) { |
| 351 gpointer item_value = | 352 gpointer item_value = |
| 352 g_hash_table_lookup(item->attributes, attribute.c_str()); | 353 g_hash_table_lookup(item->attributes, attribute.c_str()); |
| 353 EXPECT_TRUE(item_value) << " in attribute " << attribute; | 354 EXPECT_TRUE(item_value) << " in attribute " << attribute; |
| 354 if (item_value) { | 355 if (item_value) { |
| 355 uint32_t int_value; | 356 uint32_t int_value; |
| 356 bool conversion_ok = | 357 bool conversion_ok = |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 974 EXPECT_EQ(form_google_, *form_list[0]); | 975 EXPECT_EQ(form_google_, *form_list[0]); |
| 975 | 976 |
| 976 EXPECT_EQ(1u, global_mock_libsecret_items->size()); | 977 EXPECT_EQ(1u, global_mock_libsecret_items->size()); |
| 977 if (!global_mock_libsecret_items->empty()) { | 978 if (!global_mock_libsecret_items->empty()) { |
| 978 CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, | 979 CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, |
| 979 "chrome-42"); | 980 "chrome-42"); |
| 980 } | 981 } |
| 981 } | 982 } |
| 982 | 983 |
| 983 // TODO(mdm): add more basic tests here at some point. | 984 // TODO(mdm): add more basic tests here at some point. |
| OLD | NEW |