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

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

Issue 156173004: Abstract IPC send out of PasswordGenerationManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adjust PasswordGenerationManager unittests Created 6 years, 10 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"
(...skipping 21 matching lines...) Expand all
32 class AutofillManager; 32 class AutofillManager;
33 } 33 }
34 34
35 namespace { 35 namespace {
36 36
37 class MockPasswordManagerDriver : public PasswordManagerDriver { 37 class MockPasswordManagerDriver : public PasswordManagerDriver {
38 public: 38 public:
39 MockPasswordManagerDriver() {} 39 MockPasswordManagerDriver() {}
40 virtual ~MockPasswordManagerDriver() {} 40 virtual ~MockPasswordManagerDriver() {}
41 41
42 MOCK_METHOD1(FillPasswordForm, 42 MOCK_METHOD1(FillPasswordForm, void(const autofill::PasswordFormFillData&));
43 void(const autofill::PasswordFormFillData& form_data));
44 MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool()); 43 MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool());
45 MOCK_METHOD0(IsOffTheRecord, bool()); 44 MOCK_METHOD0(IsOffTheRecord, bool());
46 MOCK_METHOD0(GetPasswordGenerationManager, PasswordGenerationManager*()); 45 MOCK_METHOD0(GetPasswordGenerationManager, PasswordGenerationManager*());
47 MOCK_METHOD0(GetPasswordManager, PasswordManager*()); 46 MOCK_METHOD0(GetPasswordManager, PasswordManager*());
48 MOCK_METHOD0(GetAutofillManager, autofill::AutofillManager*()); 47 MOCK_METHOD0(GetAutofillManager, autofill::AutofillManager*());
49 MOCK_METHOD1(AllowPasswordGenerationForForm, 48 MOCK_METHOD1(AllowPasswordGenerationForForm, void(autofill::PasswordForm*));
50 void(autofill::PasswordForm* form)); 49 MOCK_METHOD1(AccountCreationFormsFound,
50 void(const std::vector<autofill::FormData>&));
51 }; 51 };
52 52
53 class TestPasswordManagerClient : public PasswordManagerClient { 53 class TestPasswordManagerClient : public PasswordManagerClient {
54 public: 54 public:
55 explicit TestPasswordManagerClient(Profile* profile) : profile_(profile) {} 55 explicit TestPasswordManagerClient(Profile* profile) : profile_(profile) {}
56 56
57 virtual void PromptUserToSavePassword(PasswordFormManager* form_to_save) 57 virtual void PromptUserToSavePassword(PasswordFormManager* form_to_save)
58 OVERRIDE {} 58 OVERRIDE {}
59 virtual Profile* GetProfile() OVERRIDE { return profile_; } 59 virtual Profile* GetProfile() OVERRIDE { return profile_; }
60 virtual PrefService* GetPrefs() OVERRIDE { return profile_->GetPrefs(); } 60 virtual PrefService* GetPrefs() OVERRIDE { return profile_->GetPrefs(); }
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 640
641 SanitizePossibleUsernames(manager.get(), &credentials); 641 SanitizePossibleUsernames(manager.get(), &credentials);
642 642
643 // SSN, duplicate in |other_possible_usernames| and duplicate of 643 // SSN, duplicate in |other_possible_usernames| and duplicate of
644 // |username_value| all removed. 644 // |username_value| all removed.
645 expected.clear(); 645 expected.clear();
646 expected.push_back(ASCIIToUTF16("duplicate")); 646 expected.push_back(ASCIIToUTF16("duplicate"));
647 expected.push_back(ASCIIToUTF16("random")); 647 expected.push_back(ASCIIToUTF16("random"));
648 EXPECT_THAT(credentials.other_possible_usernames, Eq(expected)); 648 EXPECT_THAT(credentials.other_possible_usernames, Eq(expected));
649 } 649 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698