OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 ~MockPasswordProtectionService() override {} | 78 ~MockPasswordProtectionService() override {} |
79 | 79 |
80 MOCK_METHOD3(FillReferrerChain, | 80 MOCK_METHOD3(FillReferrerChain, |
81 void(const GURL&, | 81 void(const GURL&, |
82 int, | 82 int, |
83 safe_browsing::LoginReputationClientRequest::Frame*)); | 83 safe_browsing::LoginReputationClientRequest::Frame*)); |
84 MOCK_METHOD0(IsExtendedReporting, bool()); | 84 MOCK_METHOD0(IsExtendedReporting, bool()); |
85 MOCK_METHOD0(IsIncognito, bool()); | 85 MOCK_METHOD0(IsIncognito, bool()); |
86 MOCK_METHOD2(IsPingingEnabled, bool(const base::Feature&, RequestOutcome*)); | 86 MOCK_METHOD2(IsPingingEnabled, bool(const base::Feature&, RequestOutcome*)); |
87 MOCK_METHOD0(IsHistorySyncEnabled, bool()); | 87 MOCK_METHOD0(IsHistorySyncEnabled, bool()); |
88 MOCK_METHOD3(MaybeStartPasswordFieldOnFocusRequest, | 88 MOCK_METHOD4(MaybeStartPasswordFieldOnFocusRequest, |
89 void(const GURL&, const GURL&, const GURL&)); | 89 void(WebContents*, const GURL&, const GURL&, const GURL&)); |
90 MOCK_METHOD2(MaybeStartProtectedPasswordEntryRequest, | 90 MOCK_METHOD3(MaybeStartProtectedPasswordEntryRequest, |
91 void(const GURL&, const std::string&)); | 91 void(WebContents*, const GURL&, const std::string&)); |
92 | 92 |
93 private: | 93 private: |
94 DISALLOW_COPY_AND_ASSIGN(MockPasswordProtectionService); | 94 DISALLOW_COPY_AND_ASSIGN(MockPasswordProtectionService); |
95 }; | 95 }; |
96 #endif | 96 #endif |
97 | 97 |
98 // TODO(vabr): Get rid of the mocked client in the client's own test, see | 98 // TODO(vabr): Get rid of the mocked client in the client's own test, see |
99 // http://crbug.com/474577. | 99 // http://crbug.com/474577. |
100 class MockChromePasswordManagerClient : public ChromePasswordManagerClient { | 100 class MockChromePasswordManagerClient : public ChromePasswordManagerClient { |
101 public: | 101 public: |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 612 |
613 #if defined(SAFE_BROWSING_DB_LOCAL) | 613 #if defined(SAFE_BROWSING_DB_LOCAL) |
614 TEST_F(ChromePasswordManagerClientTest, | 614 TEST_F(ChromePasswordManagerClientTest, |
615 VerifyMaybeStartPasswordFieldOnFocusRequestCalled) { | 615 VerifyMaybeStartPasswordFieldOnFocusRequestCalled) { |
616 std::unique_ptr<WebContents> test_web_contents( | 616 std::unique_ptr<WebContents> test_web_contents( |
617 content::WebContentsTester::CreateTestWebContents( | 617 content::WebContentsTester::CreateTestWebContents( |
618 web_contents()->GetBrowserContext(), nullptr)); | 618 web_contents()->GetBrowserContext(), nullptr)); |
619 std::unique_ptr<MockChromePasswordManagerClient> client( | 619 std::unique_ptr<MockChromePasswordManagerClient> client( |
620 new MockChromePasswordManagerClient(test_web_contents.get())); | 620 new MockChromePasswordManagerClient(test_web_contents.get())); |
621 EXPECT_CALL(*client->password_protection_service(), | 621 EXPECT_CALL(*client->password_protection_service(), |
622 MaybeStartPasswordFieldOnFocusRequest(_, _, _)) | 622 MaybeStartPasswordFieldOnFocusRequest(_, _, _, _)) |
623 .Times(1); | 623 .Times(1); |
624 client->CheckSafeBrowsingReputation(GURL("http://foo.com/submit"), | 624 client->CheckSafeBrowsingReputation(GURL("http://foo.com/submit"), |
625 GURL("http://foo.com/iframe.html")); | 625 GURL("http://foo.com/iframe.html")); |
626 } | 626 } |
627 | 627 |
628 TEST_F(ChromePasswordManagerClientTest, | 628 TEST_F(ChromePasswordManagerClientTest, |
629 VerifyMaybeProtectedPasswordEntryRequestCalled) { | 629 VerifyMaybeProtectedPasswordEntryRequestCalled) { |
630 std::unique_ptr<WebContents> test_web_contents( | 630 std::unique_ptr<WebContents> test_web_contents( |
631 content::WebContentsTester::CreateTestWebContents( | 631 content::WebContentsTester::CreateTestWebContents( |
632 web_contents()->GetBrowserContext(), nullptr)); | 632 web_contents()->GetBrowserContext(), nullptr)); |
633 std::unique_ptr<MockChromePasswordManagerClient> client( | 633 std::unique_ptr<MockChromePasswordManagerClient> client( |
634 new MockChromePasswordManagerClient(test_web_contents.get())); | 634 new MockChromePasswordManagerClient(test_web_contents.get())); |
635 EXPECT_CALL(*client->password_protection_service(), | 635 EXPECT_CALL(*client->password_protection_service(), |
636 MaybeStartProtectedPasswordEntryRequest(_, _)) | 636 MaybeStartProtectedPasswordEntryRequest(_, _, _)) |
637 .Times(1); | 637 .Times(1); |
638 client->CheckProtectedPasswordEntry(std::string("saved_domain.com")); | 638 client->CheckProtectedPasswordEntry(std::string("saved_domain.com")); |
639 } | 639 } |
640 | 640 |
641 #endif | 641 #endif |
OLD | NEW |