Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / passwords / manage_passwords_test.h
blobf9ef9f539c5870bfccf75ee40c76d90df6e2c9d5
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/metrics/histogram_samples.h"
9 #include "base/test/histogram_tester.h"
10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "components/autofill/core/common/password_form.h"
12 #include "components/password_manager/core/common/credential_manager_types.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 class ManagePasswordsUIController;
17 class ManagePasswordsIcon;
18 class GURL;
20 // Test class for the various password management view bits and pieces. Sets
21 // up a ManagePasswordsUIControllerMock, and provides some helper methods
22 // to poke at the bubble, icon, and controller's state.
23 class ManagePasswordsTest : public InProcessBrowserTest {
24 public:
25 ManagePasswordsTest();
26 ~ManagePasswordsTest();
28 // InProcessBrowserTest:
29 void SetUpOnMainThread() override;
31 // Get the icon view for the current WebContents.
32 virtual ManagePasswordsIcon* view() = 0;
34 // Execute the browser command to open the manage passwords bubble.
35 void ExecuteManagePasswordsCommand();
37 // Put the controller, icon, and bubble into a managing-password state.
38 void SetupManagingPasswords();
40 // Put the controller, icon, and bubble into the confirmation state.
41 void SetupAutomaticPassword();
43 // Put the controller, icon, and bubble into a pending-password state.
44 void SetupPendingPassword();
46 // Put the controller, icon, and bubble into a blacklisted state.
47 void SetupBlackistedPassword();
49 // Put the controller, icon, and bubble into a choosing credential state.
50 void SetupChooseCredentials(
51 ScopedVector<autofill::PasswordForm> local_credentials,
52 ScopedVector<autofill::PasswordForm> federated_credentials,
53 const GURL& origin);
55 // Put the controller, icon, and bubble into an auto sign-in state.
56 void SetupAutoSignin(
57 ScopedVector<autofill::PasswordForm> local_credentials);
59 // Get samples for |histogram|.
60 base::HistogramSamples* GetSamples(const char* histogram);
62 autofill::PasswordForm* test_form() { return &test_form_; }
64 // Get the UI controller for the current WebContents.
65 ManagePasswordsUIController* GetController();
67 MOCK_METHOD1(OnChooseCredential,
68 void(const password_manager::CredentialInfo&));
70 private:
71 autofill::PasswordForm test_form_;
72 base::HistogramTester histogram_tester_;
74 DISALLOW_COPY_AND_ASSIGN(ManagePasswordsTest);
77 #endif // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_TEST_H_