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

Side by Side Diff: chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc

Issue 2468763002: MD Settings: fix chrome.passwordsPrivate empty list bug (Closed)
Patch Set: git cl format + compile + const ref + bool rename Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 ~TestDelegate() override {} 71 ~TestDelegate() override {}
72 72
73 void SendSavedPasswordsList() override { 73 void SendSavedPasswordsList() override {
74 PasswordsPrivateEventRouter* router = 74 PasswordsPrivateEventRouter* router =
75 PasswordsPrivateEventRouterFactory::GetForProfile(profile_); 75 PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
76 if (router) 76 if (router)
77 router->OnSavedPasswordsListChanged(current_entries_); 77 router->OnSavedPasswordsListChanged(current_entries_);
78 } 78 }
79 79
80 const std::vector<api::passwords_private::PasswordUiEntry>* 80 void GetSavedPasswordsList(const UiEntriesCallback& callback) override {
81 GetSavedPasswordsList() const override { 81 callback.Run(current_entries_);
82 return &current_entries_;
83 } 82 }
84 83
85 void SendPasswordExceptionsList() override { 84 void SendPasswordExceptionsList() override {
86 PasswordsPrivateEventRouter* router = 85 PasswordsPrivateEventRouter* router =
87 PasswordsPrivateEventRouterFactory::GetForProfile(profile_); 86 PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
88 if (router) 87 if (router)
89 router->OnPasswordExceptionsListChanged(current_exceptions_); 88 router->OnPasswordExceptionsListChanged(current_exceptions_);
90 } 89 }
91 90
92 const std::vector<api::passwords_private::ExceptionPair>* 91 void GetPasswordExceptionsList(
93 GetPasswordExceptionsList() const override { 92 const ExceptionPairsCallback& callback) override {
94 return &current_exceptions_; 93 callback.Run(current_exceptions_);
95 } 94 }
96 95
97 void RemoveSavedPassword( 96 void RemoveSavedPassword(
98 const std::string& origin_url, const std::string& username) override { 97 const std::string& origin_url, const std::string& username) override {
99 if (current_entries_.empty()) 98 if (current_entries_.empty())
100 return; 99 return;
101 100
102 // Since this is just mock data, remove the first entry regardless of 101 // Since this is just mock data, remove the first entry regardless of
103 // the data contained. 102 // the data contained.
104 current_entries_.erase(current_entries_.begin()); 103 current_entries_.erase(current_entries_.begin());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 201
203 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, GetSavedPasswordList) { 202 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, GetSavedPasswordList) {
204 EXPECT_TRUE(RunPasswordsSubtest("getSavedPasswordList")) << message_; 203 EXPECT_TRUE(RunPasswordsSubtest("getSavedPasswordList")) << message_;
205 } 204 }
206 205
207 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, GetPasswordExceptionList) { 206 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, GetPasswordExceptionList) {
208 EXPECT_TRUE(RunPasswordsSubtest("getPasswordExceptionList")) << message_; 207 EXPECT_TRUE(RunPasswordsSubtest("getPasswordExceptionList")) << message_;
209 } 208 }
210 209
211 } // namespace extensions 210 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698