Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: components/password_manager/core/browser/password_autofill_manager_unittest.cc

Issue 707173004: Refactor Autofill for out of process iframes (OOPIF). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mem leak Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/password_manager/core/browser/password_autofill_manager.h" 5 #include "components/password_manager/core/browser/password_autofill_manager.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/autofill/core/browser/popup_item_ids.h" 10 #include "components/autofill/core/browser/popup_item_ids.h"
(...skipping 28 matching lines...) Expand all
39 class MockPasswordManagerDriver : public StubPasswordManagerDriver { 39 class MockPasswordManagerDriver : public StubPasswordManagerDriver {
40 public: 40 public:
41 MOCK_METHOD2(FillSuggestion, 41 MOCK_METHOD2(FillSuggestion,
42 void(const base::string16&, const base::string16&)); 42 void(const base::string16&, const base::string16&));
43 MOCK_METHOD2(PreviewSuggestion, 43 MOCK_METHOD2(PreviewSuggestion,
44 void(const base::string16&, const base::string16&)); 44 void(const base::string16&, const base::string16&));
45 }; 45 };
46 46
47 class TestPasswordManagerClient : public StubPasswordManagerClient { 47 class TestPasswordManagerClient : public StubPasswordManagerClient {
48 public: 48 public:
49 PasswordManagerDriver* GetDriver() override { return &driver_; }
50
51 MockPasswordManagerDriver* mock_driver() { return &driver_; } 49 MockPasswordManagerDriver* mock_driver() { return &driver_; }
52 50
53 private: 51 private:
54 MockPasswordManagerDriver driver_; 52 MockPasswordManagerDriver driver_;
55 }; 53 };
56 54
57 class MockAutofillClient : public autofill::TestAutofillClient { 55 class MockAutofillClient : public autofill::TestAutofillClient {
58 public: 56 public:
59 MOCK_METHOD7(ShowAutofillPopup, 57 MOCK_METHOD7(ShowAutofillPopup,
60 void(const gfx::RectF& element_bounds, 58 void(const gfx::RectF& element_bounds,
(...skipping 22 matching lines...) Expand all
83 username_field.value = test_username_; 81 username_field.value = test_username_;
84 fill_data_.username_field = username_field; 82 fill_data_.username_field = username_field;
85 83
86 autofill::FormFieldData password_field; 84 autofill::FormFieldData password_field;
87 password_field.name = base::ASCIIToUTF16(kPasswordName); 85 password_field.name = base::ASCIIToUTF16(kPasswordName);
88 password_field.value = test_password_; 86 password_field.value = test_password_;
89 fill_data_.password_field = password_field; 87 fill_data_.password_field = password_field;
90 } 88 }
91 89
92 void InitializePasswordAutofillManager( 90 void InitializePasswordAutofillManager(
93 PasswordManagerClient* client, 91 TestPasswordManagerClient* client,
94 autofill::AutofillClient* autofill_client) { 92 autofill::AutofillClient* autofill_client) {
95 password_autofill_manager_.reset( 93 password_autofill_manager_.reset(new PasswordAutofillManager(
96 new PasswordAutofillManager(client, autofill_client)); 94 client, client->mock_driver(), autofill_client));
97 password_autofill_manager_->OnAddPasswordFormMapping(fill_data_id_, 95 password_autofill_manager_->OnAddPasswordFormMapping(fill_data_id_,
98 fill_data_); 96 fill_data_);
99 } 97 }
100 98
101 protected: 99 protected:
102 int fill_data_id() { return fill_data_id_; } 100 int fill_data_id() { return fill_data_id_; }
103 101
104 scoped_ptr<PasswordAutofillManager> password_autofill_manager_; 102 scoped_ptr<PasswordAutofillManager> password_autofill_manager_;
105 103
106 base::string16 test_username_; 104 base::string16 test_username_;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 element_bounds, _, 255 element_bounds, _,
258 testing::UnorderedElementsAre( 256 testing::UnorderedElementsAre(
259 test_username_, additional_username, other_username), 257 test_username_, additional_username, other_username),
260 _, _, _, _)); 258 _, _, _, _));
261 password_autofill_manager_->OnShowPasswordSuggestions( 259 password_autofill_manager_->OnShowPasswordSuggestions(
262 dummy_key, base::i18n::RIGHT_TO_LEFT, base::ASCIIToUTF16("xyz"), true, 260 dummy_key, base::i18n::RIGHT_TO_LEFT, base::ASCIIToUTF16("xyz"), true,
263 element_bounds); 261 element_bounds);
264 } 262 }
265 263
266 } // namespace password_manager 264 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698