Chromium Code Reviews| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/password_manager/mock_password_store.h" | 10 #include "chrome/browser/password_manager/mock_password_store.h" |
| 11 #include "chrome/browser/password_manager/password_manager.h" | 11 #include "chrome/browser/password_manager/password_manager.h" |
| 12 #include "chrome/browser/password_manager/password_manager_delegate.h" | 12 #include "chrome/browser/password_manager/password_manager_delegate.h" |
| 13 #include "chrome/browser/password_manager/password_manager_util.h" | |
| 13 #include "chrome/browser/password_manager/password_store.h" | 14 #include "chrome/browser/password_manager/password_store.h" |
| 14 #include "chrome/browser/password_manager/password_store_factory.h" | 15 #include "chrome/browser/password_manager/password_store_factory.h" |
| 15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 17 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 18 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 18 #include "chrome/test/base/testing_pref_service_syncable.h" | 19 #include "chrome/test/base/testing_pref_service_syncable.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 20 #include "content/public/browser/navigation_details.h" | 21 #include "content/public/browser/navigation_details.h" |
| 21 #include "content/public/common/frame_navigate_params.h" | 22 #include "content/public/common/frame_navigate_params.h" |
| 22 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 manager()->OnPasswordFormsParsed(observed); // The post-navigation load. | 530 manager()->OnPasswordFormsParsed(observed); // The post-navigation load. |
| 530 manager()->OnPasswordFormsRendered(observed); // The post-navigation layout. | 531 manager()->OnPasswordFormsRendered(observed); // The post-navigation layout. |
| 531 } | 532 } |
| 532 | 533 |
| 533 TEST_F(PasswordManagerTest, SubmissionCallbackTest) { | 534 TEST_F(PasswordManagerTest, SubmissionCallbackTest) { |
| 534 manager()->AddSubmissionCallback(SubmissionCallback()); | 535 manager()->AddSubmissionCallback(SubmissionCallback()); |
| 535 PasswordForm form = MakeSimpleForm(); | 536 PasswordForm form = MakeSimpleForm(); |
| 536 OnPasswordFormSubmitted(form); | 537 OnPasswordFormSubmitted(form); |
| 537 EXPECT_TRUE(FormsAreEqual(form, submitted_form_)); | 538 EXPECT_TRUE(FormsAreEqual(form, submitted_form_)); |
| 538 } | 539 } |
| 540 | |
| 541 TEST_F(PasswordManagerTest, IsDomainNameMonitoredTest) { | |
| 542 std::string domain_name; | |
| 543 | |
| 544 EXPECT_TRUE(password_manager_util::IsDomainNameMonitored( | |
| 545 "https://www.linkedin.com", &domain_name)); | |
| 546 ASSERT_TRUE(domain_name == "linkedin.com"); | |
| 547 EXPECT_TRUE(password_manager_util::IsDomainNameMonitored( | |
| 548 "https://www.amazon.com", &domain_name)); | |
| 549 ASSERT_TRUE(domain_name == "amazon.com"); | |
| 550 EXPECT_FALSE(password_manager_util::IsDomainNameMonitored( | |
| 551 "https://www.facebook.com", &domain_name)); | |
| 552 ASSERT_TRUE(domain_name == ""); | |
|
vabr (Chromium)
2013/08/28 15:49:45
Please also add tests for bare domains ("yahoo.com
| |
| 553 } | |
| OLD | NEW |