Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / passwords / manage_passwords_test.h
blobb9e8e07eb5fcdae5e86f0452099260b8b3d26a34
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_
6 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/metrics/histogram_samples.h"
10 #include "base/test/histogram_tester.h"
11 #include "chrome/test/base/in_process_browser_test.h"
12 #include "components/autofill/core/common/password_form.h"
13 #include "components/password_manager/core/common/credential_manager_types.h"
14 #include "testing/gmock/include/gmock/gmock.h"
15 #include "testing/gtest/include/gtest/gtest.h"
17 class ManagePasswordsUIController;
18 class ManagePasswordsIcon;
19 class GURL;
21 // Test class for the various password management view bits and pieces. Sets
22 // up a ManagePasswordsUIControllerMock, and provides some helper methods
23 // to poke at the bubble, icon, and controller's state.
24 class ManagePasswordsTest : public InProcessBrowserTest {
25 public:
26 ManagePasswordsTest();
27 ~ManagePasswordsTest();
29 // InProcessBrowserTest:
30 void SetUpOnMainThread() override;
32 // Get the icon view for the current WebContents.
33 virtual ManagePasswordsIcon* view() = 0;
35 // Execute the browser command to open the manage passwords bubble.
36 void ExecuteManagePasswordsCommand();
38 // Put the controller, icon, and bubble into a managing-password state.
39 void SetupManagingPasswords();
41 // Put the controller, icon, and bubble into the confirmation state.
42 void SetupAutomaticPassword();
44 // Put the controller, icon, and bubble into a pending-password state.
45 void SetupPendingPassword();
47 // Put the controller, icon, and bubble into a blacklisted state.
48 void SetupBlackistedPassword();
50 // Put the controller, icon, and bubble into a choosing credential state.
51 void SetupChooseCredentials(
52 ScopedVector<autofill::PasswordForm> local_credentials,
53 ScopedVector<autofill::PasswordForm> federated_credentials,
54 const GURL& origin);
56 // Put the controller, icon, and bubble into an auto sign-in state.
57 void SetupAutoSignin(
58 ScopedVector<autofill::PasswordForm> local_credentials);
60 // Get samples for |histogram|.
61 scoped_ptr<base::HistogramSamples> GetSamples(const char* histogram);
63 autofill::PasswordForm* test_form() { return &test_form_; }
65 // Get the UI controller for the current WebContents.
66 ManagePasswordsUIController* GetController();
68 MOCK_METHOD1(OnChooseCredential,
69 void(const password_manager::CredentialInfo&));
71 private:
72 autofill::PasswordForm test_form_;
73 base::HistogramTester histogram_tester_;
75 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsTest);
78 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_