| OLD | NEW |
| 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/gmock/include/gmock/gmock.h" | 5 #include "testing/gmock/include/gmock/gmock.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "chrome/browser/password_manager/password_store_consumer.h" | 14 #include "chrome/browser/password_manager/password_store_consumer.h" |
| 15 #include "chrome/browser/password_manager/password_store_mac.h" | 15 #include "chrome/browser/password_manager/password_store_mac.h" |
| 16 #include "chrome/browser/password_manager/password_store_mac_internal.h" | 16 #include "chrome/browser/password_manager/password_store_mac_internal.h" |
| 17 #include "chrome/common/chrome_paths.h" | 17 #include "chrome/common/chrome_paths.h" |
| 18 #include "content/public/test/test_browser_thread.h" | 18 #include "content/public/test/test_browser_thread.h" |
| 19 #include "crypto/mock_apple_keychain.h" | 19 #include "crypto/mock_apple_keychain.h" |
| 20 | 20 |
| 21 using autofill::PasswordForm; |
| 21 using content::BrowserThread; | 22 using content::BrowserThread; |
| 22 using crypto::MockAppleKeychain; | 23 using crypto::MockAppleKeychain; |
| 23 using content::PasswordForm; | |
| 24 using testing::_; | 24 using testing::_; |
| 25 using testing::DoAll; | 25 using testing::DoAll; |
| 26 using testing::WithArg; | 26 using testing::WithArg; |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 class MockPasswordStoreConsumer : public PasswordStoreConsumer { | 30 class MockPasswordStoreConsumer : public PasswordStoreConsumer { |
| 31 public: | 31 public: |
| 32 MOCK_METHOD2(OnPasswordStoreRequestDone, | 32 MOCK_METHOD2(OnPasswordStoreRequestDone, |
| 33 void(CancelableRequestProvider::Handle, | 33 void(CancelableRequestProvider::Handle, |
| 34 const std::vector<content::PasswordForm*>&)); | 34 const std::vector<autofill::PasswordForm*>&)); |
| 35 MOCK_METHOD1(OnGetPasswordStoreResults, | 35 MOCK_METHOD1(OnGetPasswordStoreResults, |
| 36 void(const std::vector<content::PasswordForm*>&)); | 36 void(const std::vector<autofill::PasswordForm*>&)); |
| 37 }; | 37 }; |
| 38 | 38 |
| 39 ACTION(STLDeleteElements0) { | 39 ACTION(STLDeleteElements0) { |
| 40 STLDeleteContainerPointers(arg0.begin(), arg0.end()); | 40 STLDeleteContainerPointers(arg0.begin(), arg0.end()); |
| 41 } | 41 } |
| 42 | 42 |
| 43 ACTION(QuitUIMessageLoop) { | 43 ACTION(QuitUIMessageLoop) { |
| 44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 44 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 45 base::MessageLoop::current()->Quit(); | 45 base::MessageLoop::current()->Quit(); |
| 46 } | 46 } |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 EXPECT_EQ(0U, matching_items.size()) << "iteration " << i; | 1021 EXPECT_EQ(0U, matching_items.size()) << "iteration " << i; |
| 1022 } | 1022 } |
| 1023 STLDeleteElements(&matching_items); | 1023 STLDeleteElements(&matching_items); |
| 1024 | 1024 |
| 1025 login_db_->GetLogins(*query_form, &matching_items); | 1025 login_db_->GetLogins(*query_form, &matching_items); |
| 1026 EXPECT_EQ(updates[i].password ? 1U : 0U, matching_items.size()) | 1026 EXPECT_EQ(updates[i].password ? 1U : 0U, matching_items.size()) |
| 1027 << "iteration " << i; | 1027 << "iteration " << i; |
| 1028 STLDeleteElements(&matching_items); | 1028 STLDeleteElements(&matching_items); |
| 1029 } | 1029 } |
| 1030 } | 1030 } |
| OLD | NEW |