OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
6 #include "chrome/browser/password_manager/mock_password_store_service.h" | 6 #include "chrome/browser/password_manager/mock_password_store_service.h" |
7 #include "chrome/browser/password_manager/password_store_factory.h" | 7 #include "chrome/browser/password_manager/password_store_factory.h" |
8 #include "chrome/browser/ui/passwords/password_manager_presenter.h" | 8 #include "chrome/browser/ui/passwords/password_manager_presenter.h" |
9 #include "chrome/browser/ui/passwords/password_ui_view.h" | 9 #include "chrome/browser/ui/passwords/password_ui_view.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
11 #include "components/password_manager/core/browser/mock_password_store.h" | 11 #include "components/password_manager/core/browser/mock_password_store.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" |
12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
14 | 15 |
15 using base::ASCIIToUTF16; | 16 using base::ASCIIToUTF16; |
16 using testing::Eq; | 17 using testing::Eq; |
17 using testing::Property; | 18 using testing::Property; |
18 | 19 |
19 class MockPasswordUIView : public PasswordUIView { | 20 class MockPasswordUIView : public PasswordUIView { |
20 public: | 21 public: |
21 explicit MockPasswordUIView(Profile* profile) | 22 explicit MockPasswordUIView(Profile* profile) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 mock_controller_.reset(new MockPasswordUIView(&profile_)); | 60 mock_controller_.reset(new MockPasswordUIView(&profile_)); |
60 } | 61 } |
61 void AddPasswordEntry(const GURL& origin, | 62 void AddPasswordEntry(const GURL& origin, |
62 const std::string& user_name, | 63 const std::string& user_name, |
63 const std::string& password); | 64 const std::string& password); |
64 void AddPasswordException(const GURL& origin); | 65 void AddPasswordException(const GURL& origin); |
65 void UpdateLists(); | 66 void UpdateLists(); |
66 MockPasswordUIView* GetUIController() { return mock_controller_.get(); } | 67 MockPasswordUIView* GetUIController() { return mock_controller_.get(); } |
67 | 68 |
68 private: | 69 private: |
| 70 content::TestBrowserThreadBundle thread_bundle_; |
69 TestingProfile profile_; | 71 TestingProfile profile_; |
70 scoped_ptr<MockPasswordUIView> mock_controller_; | 72 scoped_ptr<MockPasswordUIView> mock_controller_; |
71 | 73 |
72 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenterTest); | 74 DISALLOW_COPY_AND_ASSIGN(PasswordManagerPresenterTest); |
73 }; | 75 }; |
74 | 76 |
75 void PasswordManagerPresenterTest::AddPasswordEntry( | 77 void PasswordManagerPresenterTest::AddPasswordEntry( |
76 const GURL& origin, | 78 const GURL& origin, |
77 const std::string& user_name, | 79 const std::string& user_name, |
78 const std::string& password) { | 80 const std::string& password) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 SetPasswordList( | 141 SetPasswordList( |
140 Property(&ScopedVector<autofill::PasswordForm>::size, Eq(2u)), | 142 Property(&ScopedVector<autofill::PasswordForm>::size, Eq(2u)), |
141 testing::_)); | 143 testing::_)); |
142 EXPECT_CALL(*GetUIController(), | 144 EXPECT_CALL(*GetUIController(), |
143 SetPasswordExceptionList(Property( | 145 SetPasswordExceptionList(Property( |
144 &ScopedVector<autofill::PasswordForm>::size, Eq(1u)))); | 146 &ScopedVector<autofill::PasswordForm>::size, Eq(1u)))); |
145 UpdateLists(); | 147 UpdateLists(); |
146 } | 148 } |
147 | 149 |
148 } // namespace | 150 } // namespace |
OLD | NEW |