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 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_ | 5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_ |
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_ | 6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_ |
7 | 7 |
8 #include "base/metrics/histogram_samples.h" | 8 #include "base/metrics/histogram_samples.h" |
9 #include "base/test/histogram_tester.h" | 9 #include "base/test/histogram_tester.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
11 #include "components/autofill/core/common/password_form.h" | 11 #include "components/autofill/core/common/password_form.h" |
12 #include "components/password_manager/content/common/credential_manager_types.h" | 12 #include "components/password_manager/content/common/credential_manager_types.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 class ManagePasswordsUIController; | 16 class ManagePasswordsUIController; |
17 class ManagePasswordsIcon; | 17 class ManagePasswordsIcon; |
| 18 class GURL; |
18 | 19 |
19 // Test class for the various password management view bits and pieces. Sets | 20 // Test class for the various password management view bits and pieces. Sets |
20 // up a ManagePasswordsUIControllerMock, and provides some helper methods | 21 // up a ManagePasswordsUIControllerMock, and provides some helper methods |
21 // to poke at the bubble, icon, and controller's state. | 22 // to poke at the bubble, icon, and controller's state. |
22 class ManagePasswordsTest : public InProcessBrowserTest { | 23 class ManagePasswordsTest : public InProcessBrowserTest { |
23 public: | 24 public: |
24 ManagePasswordsTest() = default; | 25 ManagePasswordsTest() = default; |
25 ~ManagePasswordsTest() = default; | 26 ~ManagePasswordsTest() = default; |
26 | 27 |
27 // InProcessBrowserTest: | 28 // InProcessBrowserTest: |
(...skipping 13 matching lines...) Expand all Loading... |
41 | 42 |
42 // Put the controller, icon, and bubble into a pending-password state. | 43 // Put the controller, icon, and bubble into a pending-password state. |
43 void SetupPendingPassword(); | 44 void SetupPendingPassword(); |
44 | 45 |
45 // Put the controller, icon, and bubble into a blacklisted state. | 46 // Put the controller, icon, and bubble into a blacklisted state. |
46 void SetupBlackistedPassword(); | 47 void SetupBlackistedPassword(); |
47 | 48 |
48 // Put the controller, icon, and bubble into a choosing credential state. | 49 // Put the controller, icon, and bubble into a choosing credential state. |
49 void SetupChooseCredentials( | 50 void SetupChooseCredentials( |
50 ScopedVector<autofill::PasswordForm> local_credentials, | 51 ScopedVector<autofill::PasswordForm> local_credentials, |
51 ScopedVector<autofill::PasswordForm> federated_credentials); | 52 ScopedVector<autofill::PasswordForm> federated_credentials, |
| 53 const GURL& origin); |
52 | 54 |
53 // Get samples for |histogram|. | 55 // Get samples for |histogram|. |
54 base::HistogramSamples* GetSamples(const char* histogram); | 56 base::HistogramSamples* GetSamples(const char* histogram); |
55 | 57 |
56 autofill::PasswordForm* test_form() { return &test_form_; } | 58 autofill::PasswordForm* test_form() { return &test_form_; } |
57 | 59 |
58 MOCK_METHOD1(OnChooseCredential, | 60 MOCK_METHOD1(OnChooseCredential, |
59 void(const password_manager::CredentialInfo&)); | 61 void(const password_manager::CredentialInfo&)); |
60 private: | 62 private: |
61 // Get the UI controller for the current WebContents. | 63 // Get the UI controller for the current WebContents. |
62 ManagePasswordsUIController* GetController(); | 64 ManagePasswordsUIController* GetController(); |
63 | 65 |
64 autofill::PasswordForm test_form_; | 66 autofill::PasswordForm test_form_; |
65 base::HistogramTester histogram_tester_; | 67 base::HistogramTester histogram_tester_; |
66 | 68 |
67 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsTest); | 69 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsTest); |
68 }; | 70 }; |
69 | 71 |
70 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_ | 72 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_ |
OLD | NEW |