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

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

Issue 1480153002: Investigate Android build problems in review 1414463004. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Add //url dep on GN test_support target. Created 5 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 (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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 public: 42 public:
43 MOCK_METHOD1(OnGetPasswordStoreResultsConstRef, 43 MOCK_METHOD1(OnGetPasswordStoreResultsConstRef,
44 void(const std::vector<PasswordForm*>&)); 44 void(const std::vector<PasswordForm*>&));
45 45
46 // GMock cannot mock methods with move-only args. 46 // GMock cannot mock methods with move-only args.
47 void OnGetPasswordStoreResults(ScopedVector<PasswordForm> results) override { 47 void OnGetPasswordStoreResults(ScopedVector<PasswordForm> results) override {
48 OnGetPasswordStoreResultsConstRef(results.get()); 48 OnGetPasswordStoreResultsConstRef(results.get());
49 } 49 }
50 }; 50 };
51 51
52 class MockPasswordStoreObserver
53 : public password_manager::PasswordStore::Observer {
54 public:
55 MOCK_METHOD1(OnLoginsChanged,
56 void(const password_manager::PasswordStoreChangeList& changes));
57 };
58
59 class FailingBackend : public PasswordStoreX::NativeBackend { 52 class FailingBackend : public PasswordStoreX::NativeBackend {
60 public: 53 public:
61 bool Init() override { return true; } 54 bool Init() override { return true; }
62 55
63 PasswordStoreChangeList AddLogin(const PasswordForm& form) override { 56 PasswordStoreChangeList AddLogin(const PasswordForm& form) override {
64 return PasswordStoreChangeList(); 57 return PasswordStoreChangeList();
65 } 58 }
66 bool UpdateLogin(const PasswordForm& form, 59 bool UpdateLogin(const PasswordForm& form,
67 PasswordStoreChangeList* changes) override { 60 PasswordStoreChangeList* changes) override {
68 return false; 61 return false;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 password_manager::PasswordFormData form_data = { 310 password_manager::PasswordFormData form_data = {
318 PasswordForm::SCHEME_HTML, "http://bar.example.com", 311 PasswordForm::SCHEME_HTML, "http://bar.example.com",
319 "http://bar.example.com/origin", "http://bar.example.com/action", 312 "http://bar.example.com/origin", "http://bar.example.com/action",
320 L"submit_element", L"username_element", 313 L"submit_element", L"username_element",
321 L"password_element", L"username_value", 314 L"password_element", L"username_value",
322 L"password_value", true, 315 L"password_value", true,
323 false, 1}; 316 false, 1};
324 scoped_ptr<PasswordForm> form = 317 scoped_ptr<PasswordForm> form =
325 CreatePasswordFormFromDataForTesting(form_data); 318 CreatePasswordFormFromDataForTesting(form_data);
326 319
327 MockPasswordStoreObserver observer; 320 password_manager::MockPasswordStoreObserver observer;
328 store->AddObserver(&observer); 321 store->AddObserver(&observer);
329 322
330 const PasswordStoreChange expected_add_changes[] = { 323 const PasswordStoreChange expected_add_changes[] = {
331 PasswordStoreChange(PasswordStoreChange::ADD, *form), 324 PasswordStoreChange(PasswordStoreChange::ADD, *form),
332 }; 325 };
333 326
334 EXPECT_CALL( 327 EXPECT_CALL(
335 observer, 328 observer,
336 OnLoginsChanged(ElementsAreArray(expected_add_changes))); 329 OnLoginsChanged(ElementsAreArray(expected_add_changes)));
337 330
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 476
484 INSTANTIATE_TEST_CASE_P(NoBackend, 477 INSTANTIATE_TEST_CASE_P(NoBackend,
485 PasswordStoreXTest, 478 PasswordStoreXTest,
486 testing::Values(NO_BACKEND)); 479 testing::Values(NO_BACKEND));
487 INSTANTIATE_TEST_CASE_P(FailingBackend, 480 INSTANTIATE_TEST_CASE_P(FailingBackend,
488 PasswordStoreXTest, 481 PasswordStoreXTest,
489 testing::Values(FAILING_BACKEND)); 482 testing::Values(FAILING_BACKEND));
490 INSTANTIATE_TEST_CASE_P(WorkingBackend, 483 INSTANTIATE_TEST_CASE_P(WorkingBackend,
491 PasswordStoreXTest, 484 PasswordStoreXTest,
492 testing::Values(WORKING_BACKEND)); 485 testing::Values(WORKING_BACKEND));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698