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

Side by Side Diff: chrome/browser/password_manager/password_form_manager_unittest.cc

Issue 19705013: [password autofill] Remove references to PasswordForm from RenderViewImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 months 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 | Annotate | Revision Log
OLDNEW
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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "chrome/browser/password_manager/password_form_manager.h" 11 #include "chrome/browser/password_manager/password_form_manager.h"
12 #include "chrome/browser/password_manager/password_manager.h" 12 #include "chrome/browser/password_manager/password_manager.h"
13 #include "chrome/browser/password_manager/password_manager_delegate.h" 13 #include "chrome/browser/password_manager/password_manager_delegate.h"
14 #include "chrome/browser/password_manager/password_store.h" 14 #include "chrome/browser/password_manager/password_store.h"
15 #include "chrome/browser/password_manager/password_store_factory.h" 15 #include "chrome/browser/password_manager/password_store_factory.h"
16 #include "chrome/browser/password_manager/test_password_store.h" 16 #include "chrome/browser/password_manager/test_password_store.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/test/base/testing_profile.h" 18 #include "chrome/test/base/testing_profile.h"
19 #include "content/public/common/password_form.h" 19 #include "content/public/common/password_form.h"
20 #include "content/public/test/test_utils.h" 20 #include "content/public/test/test_utils.h"
21 #include "testing/gmock/include/gmock/gmock.h" 21 #include "testing/gmock/include/gmock/gmock.h"
22 22
23 using content::PasswordForm; 23 using content::PasswordForm;
24 24
25 using ::testing::Eq; 25 using ::testing::Eq;
26 26
27 namespace {
28
27 class TestPasswordManagerDelegate : public PasswordManagerDelegate { 29 class TestPasswordManagerDelegate : public PasswordManagerDelegate {
28 public: 30 public:
29 explicit TestPasswordManagerDelegate(Profile* profile) : profile_(profile) {} 31 explicit TestPasswordManagerDelegate(Profile* profile) : profile_(profile) {}
30 32
31 virtual void FillPasswordForm( 33 virtual void FillPasswordForm(
32 const autofill::PasswordFormFillData& form_data) OVERRIDE {} 34 const autofill::PasswordFormFillData& form_data) OVERRIDE {}
33 virtual void AddSavePasswordInfoBarIfPermitted( 35 virtual void AddSavePasswordInfoBarIfPermitted(
34 PasswordFormManager* form_to_save) OVERRIDE {} 36 PasswordFormManager* form_to_save) OVERRIDE {}
35 virtual Profile* GetProfile() OVERRIDE { return profile_; } 37 virtual Profile* GetProfile() OVERRIDE { return profile_; }
36 virtual bool DidLastPageLoadEncounterSSLErrors() OVERRIDE { return false; } 38 virtual bool DidLastPageLoadEncounterSSLErrors() OVERRIDE { return false; }
37 39
38 private: 40 private:
39 Profile* profile_; 41 Profile* profile_;
40 }; 42 };
41 43
42 class TestPasswordManager : public PasswordManager { 44 class TestPasswordManager : public PasswordManager {
43 public: 45 public:
44 explicit TestPasswordManager(PasswordManagerDelegate* delegate) 46 explicit TestPasswordManager(PasswordManagerDelegate* delegate)
45 : PasswordManager(NULL, delegate) {} 47 : PasswordManager(NULL, delegate) {}
46 48
47 virtual void Autofill( 49 virtual void Autofill(
48 const content::PasswordForm& form_for_autofill, 50 const content::PasswordForm& form_for_autofill,
49 const content::PasswordFormMap& best_matches, 51 const content::PasswordFormMap& best_matches,
50 const content::PasswordForm& preferred_match, 52 const content::PasswordForm& preferred_match,
51 bool wait_for_username) const OVERRIDE {} 53 bool wait_for_username) const OVERRIDE {}
52 }; 54 };
53 55
56 } // namespace
57
54 class TestPasswordFormManager : public PasswordFormManager { 58 class TestPasswordFormManager : public PasswordFormManager {
55 public: 59 public:
56 TestPasswordFormManager(Profile* profile, 60 TestPasswordFormManager(Profile* profile,
57 PasswordManager* manager, 61 PasswordManager* manager,
58 const content::PasswordForm& observed_form, 62 const content::PasswordForm& observed_form,
59 bool ssl_valid) 63 bool ssl_valid)
60 : PasswordFormManager(profile, manager, NULL, observed_form, ssl_valid), 64 : PasswordFormManager(profile, manager, NULL, observed_form, ssl_valid),
61 num_sent_messages_(0) {} 65 num_sent_messages_(0) {}
62 66
63 virtual void SendNotBlacklistedToRenderer() OVERRIDE { 67 virtual void SendNotBlacklistedToRenderer() OVERRIDE {
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 541
538 SanitizePossibleUsernames(manager.get(), &credentials); 542 SanitizePossibleUsernames(manager.get(), &credentials);
539 543
540 // SSN, duplicate in |other_possible_usernames| and duplicate of 544 // SSN, duplicate in |other_possible_usernames| and duplicate of
541 // |username_value| all removed. 545 // |username_value| all removed.
542 expected.clear(); 546 expected.clear();
543 expected.push_back(ASCIIToUTF16("duplicate")); 547 expected.push_back(ASCIIToUTF16("duplicate"));
544 expected.push_back(ASCIIToUTF16("random")); 548 expected.push_back(ASCIIToUTF16("random"));
545 EXPECT_THAT(credentials.other_possible_usernames, Eq(expected)); 549 EXPECT_THAT(credentials.other_possible_usernames, Eq(expected));
546 } 550 }
OLDNEW
« no previous file with comments | « chrome/browser/android/tab_android.cc ('k') | chrome/browser/password_manager/password_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698