OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/password_manager/core/browser/password_manager.h" | 5 #include "components/password_manager/core/browser/password_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/prefs/pref_registry_simple.h" | 11 #include "base/prefs/pref_registry_simple.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "base/prefs/testing_pref_service.h" | 13 #include "base/prefs/testing_pref_service.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "components/password_manager/core/browser/mock_password_store.h" | 16 #include "components/password_manager/core/browser/mock_password_store.h" |
17 #include "components/password_manager/core/browser/password_autofill_manager.h" | 17 #include "components/password_manager/core/browser/password_autofill_manager.h" |
18 #include "components/password_manager/core/browser/password_manager_driver.h" | 18 #include "components/password_manager/core/browser/password_manager_driver.h" |
19 #include "components/password_manager/core/browser/password_store.h" | 19 #include "components/password_manager/core/browser/password_store.h" |
20 #include "components/password_manager/core/browser/stub_password_manager_client.
h" | 20 #include "components/password_manager/core/browser/stub_password_manager_client.
h" |
21 #include "components/password_manager/core/browser/stub_password_manager_driver.
h" | 21 #include "components/password_manager/core/browser/stub_password_manager_driver.
h" |
22 #include "components/password_manager/core/common/password_manager_pref_names.h" | 22 #include "components/password_manager/core/common/password_manager_pref_names.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 | 25 |
26 class PasswordGenerationManager; | |
27 | |
28 using autofill::PasswordForm; | 26 using autofill::PasswordForm; |
29 using base::ASCIIToUTF16; | 27 using base::ASCIIToUTF16; |
30 using testing::_; | 28 using testing::_; |
31 using testing::AnyNumber; | 29 using testing::AnyNumber; |
32 using testing::DoAll; | 30 using testing::DoAll; |
33 using testing::Exactly; | 31 using testing::Exactly; |
34 using testing::Return; | 32 using testing::Return; |
35 using testing::WithArg; | 33 using testing::WithArg; |
36 | 34 |
37 namespace autofill { | |
38 class AutofillManager; | |
39 } | |
40 | |
41 namespace password_manager { | 35 namespace password_manager { |
42 | 36 |
43 namespace { | 37 namespace { |
44 | 38 |
45 class MockPasswordManagerClient : public StubPasswordManagerClient { | 39 class MockPasswordManagerClient : public StubPasswordManagerClient { |
46 public: | 40 public: |
47 MOCK_CONST_METHOD0(IsPasswordManagerEnabledForCurrentPage, bool()); | 41 MOCK_CONST_METHOD0(IsPasswordManagerEnabledForCurrentPage, bool()); |
48 MOCK_CONST_METHOD2(IsSyncAccountCredential, | 42 MOCK_CONST_METHOD2(IsSyncAccountCredential, |
49 bool(const std::string&, const std::string&)); | 43 bool(const std::string&, const std::string&)); |
50 MOCK_METHOD1(PromptUserToSavePasswordPtr, void(PasswordFormManager*)); | 44 MOCK_METHOD1(PromptUserToSavePasswordPtr, void(PasswordFormManager*)); |
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 true); // The post-navigation layout. | 859 true); // The post-navigation layout. |
866 | 860 |
867 ASSERT_TRUE(form_to_save.get()); | 861 ASSERT_TRUE(form_to_save.get()); |
868 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); | 862 EXPECT_CALL(*store_.get(), AddLogin(FormMatches(form))); |
869 | 863 |
870 // Simulate saving the form, as if the info bar was accepted. | 864 // Simulate saving the form, as if the info bar was accepted. |
871 form_to_save->Save(); | 865 form_to_save->Save(); |
872 } | 866 } |
873 | 867 |
874 } // namespace password_manager | 868 } // namespace password_manager |
OLD | NEW |