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

Side by Side Diff: chrome/browser/ui/passwords/password_manager_presenter_unittest.cc

Issue 34393007: [Win] Add option to reauthenticate the OS user before revealing passwords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@password
Patch Set: remove GetNativeWindow from OS_ANDROID Created 7 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/password_manager/mock_password_store.h" 6 #include "chrome/browser/password_manager/mock_password_store.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 "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 using base::ASCIIToUTF16; 14 using base::ASCIIToUTF16;
15 using testing::Eq; 15 using testing::Eq;
16 using testing::Property; 16 using testing::Property;
17 17
18 class MockPasswordUIView : public PasswordUIView { 18 class MockPasswordUIView : public PasswordUIView {
19 public: 19 public:
20 explicit MockPasswordUIView(Profile* profile) 20 explicit MockPasswordUIView(Profile* profile)
21 : profile_(profile), password_manager_presenter_(this) { 21 : profile_(profile), password_manager_presenter_(this) {
22 password_manager_presenter_.Initialize(); 22 password_manager_presenter_.Initialize();
23 } 23 }
24 virtual ~MockPasswordUIView() {} 24 virtual ~MockPasswordUIView() {}
25 virtual Profile* GetProfile() OVERRIDE; 25 virtual Profile* GetProfile() OVERRIDE;
26 #if !defined(OS_ANDROID)
27 virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
28 #endif
26 MOCK_METHOD2(ShowPassword, void(size_t, const string16&)); 29 MOCK_METHOD2(ShowPassword, void(size_t, const string16&));
27 MOCK_METHOD2(SetPasswordList, 30 MOCK_METHOD2(SetPasswordList,
28 void(const ScopedVector<autofill::PasswordForm>&, bool)); 31 void(const ScopedVector<autofill::PasswordForm>&, bool));
29 MOCK_METHOD1(SetPasswordExceptionList, 32 MOCK_METHOD1(SetPasswordExceptionList,
30 void(const ScopedVector<autofill::PasswordForm>&)); 33 void(const ScopedVector<autofill::PasswordForm>&));
31 PasswordManagerPresenter* GetPasswordManagerPresenter() { 34 PasswordManagerPresenter* GetPasswordManagerPresenter() {
32 return &password_manager_presenter_; 35 return &password_manager_presenter_;
33 } 36 }
34 37
35 private: 38 private:
36 Profile* profile_; 39 Profile* profile_;
37 PasswordManagerPresenter password_manager_presenter_; 40 PasswordManagerPresenter password_manager_presenter_;
38 41
39 DISALLOW_COPY_AND_ASSIGN(MockPasswordUIView); 42 DISALLOW_COPY_AND_ASSIGN(MockPasswordUIView);
40 }; 43 };
41 44
45 #if !defined(OS_ANDROID)
46 gfx::NativeWindow MockPasswordUIView::GetNativeWindow() { return NULL; }
47 #endif
42 Profile* MockPasswordUIView::GetProfile() { return profile_; } 48 Profile* MockPasswordUIView::GetProfile() { return profile_; }
43 49
44 class PasswordManagerPresenterTest : public testing::Test { 50 class PasswordManagerPresenterTest : public testing::Test {
45 protected: 51 protected:
46 PasswordManagerPresenterTest() {} 52 PasswordManagerPresenterTest() {}
47 53
48 virtual ~PasswordManagerPresenterTest() {} 54 virtual ~PasswordManagerPresenterTest() {}
49 virtual void SetUp() OVERRIDE { 55 virtual void SetUp() OVERRIDE {
50 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse( 56 PasswordStoreFactory::GetInstance()->SetTestingFactoryAndUse(
51 &profile_, MockPasswordStore::Build); 57 &profile_, MockPasswordStore::Build);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 SetPasswordList( 138 SetPasswordList(
133 Property(&ScopedVector<autofill::PasswordForm>::size, Eq(2u)), 139 Property(&ScopedVector<autofill::PasswordForm>::size, Eq(2u)),
134 testing::_)); 140 testing::_));
135 EXPECT_CALL(*GetUIController(), 141 EXPECT_CALL(*GetUIController(),
136 SetPasswordExceptionList(Property( 142 SetPasswordExceptionList(Property(
137 &ScopedVector<autofill::PasswordForm>::size, Eq(1u)))); 143 &ScopedVector<autofill::PasswordForm>::size, Eq(1u))));
138 UpdateLists(); 144 UpdateLists();
139 } 145 }
140 146
141 } // namespace 147 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/passwords/password_manager_presenter.cc ('k') | chrome/browser/ui/passwords/password_ui_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698