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

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

Issue 1892613006: Add functions to the passwords private api that update the lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 8 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 ~TestDelegate() override {} 66 ~TestDelegate() override {}
67 67
68 void SendSavedPasswordsList() override { 68 void SendSavedPasswordsList() override {
69 PasswordsPrivateEventRouter* router = 69 PasswordsPrivateEventRouter* router =
70 PasswordsPrivateEventRouterFactory::GetForProfile(profile_); 70 PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
71 if (router) 71 if (router)
72 router->OnSavedPasswordsListChanged(current_entries_); 72 router->OnSavedPasswordsListChanged(current_entries_);
73 } 73 }
74 74
75 const std::vector<api::passwords_private::PasswordUiEntry>*
76 GetSavedPasswordsList() const override {
77 return &current_entries_;
78 }
79
75 void SendPasswordExceptionsList() override { 80 void SendPasswordExceptionsList() override {
76 PasswordsPrivateEventRouter* router = 81 PasswordsPrivateEventRouter* router =
77 PasswordsPrivateEventRouterFactory::GetForProfile(profile_); 82 PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
78 if (router) 83 if (router)
79 router->OnPasswordExceptionsListChanged(current_exceptions_); 84 router->OnPasswordExceptionsListChanged(current_exceptions_);
80 } 85 }
81 86
87 const std::vector<std::string>* GetPasswordExceptionsList() const override {
88 return &current_exceptions_;
89 }
90
82 void RemoveSavedPassword( 91 void RemoveSavedPassword(
83 const std::string& origin_url, const std::string& username) override { 92 const std::string& origin_url, const std::string& username) override {
84 if (!current_entries_.size()) 93 if (!current_entries_.size())
85 return; 94 return;
86 95
87 // Since this is just mock data, remove the first entry regardless of 96 // Since this is just mock data, remove the first entry regardless of
88 // the data contained. 97 // the data contained.
89 current_entries_.erase(current_entries_.begin()); 98 current_entries_.erase(current_entries_.begin());
90 SendSavedPasswordsList(); 99 SendSavedPasswordsList();
91 } 100 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 187 }
179 188
180 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, RemovePasswordException) { 189 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, RemovePasswordException) {
181 EXPECT_TRUE(RunPasswordsSubtest("removePasswordException")) << message_; 190 EXPECT_TRUE(RunPasswordsSubtest("removePasswordException")) << message_;
182 } 191 }
183 192
184 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, RequestPlaintextPassword) { 193 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, RequestPlaintextPassword) {
185 EXPECT_TRUE(RunPasswordsSubtest("requestPlaintextPassword")) << message_; 194 EXPECT_TRUE(RunPasswordsSubtest("requestPlaintextPassword")) << message_;
186 } 195 }
187 196
197 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, GetSavedPasswordList) {
198 EXPECT_TRUE(RunPasswordsSubtest("getSavedPasswordList")) << message_;
199 }
200
201 IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, GetPasswordExceptionList) {
202 EXPECT_TRUE(RunPasswordsSubtest("getPasswordExceptionList")) << message_;
203 }
204
188 } // namespace extensions 205 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698