| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/password_manager/mock_password_store.h" | 10 #include "chrome/browser/password_manager/mock_password_store.h" |
| 11 #include "chrome/browser/password_manager/password_manager.h" | 11 #include "chrome/browser/password_manager/password_manager.h" |
| 12 #include "chrome/browser/password_manager/password_manager_delegate.h" | 12 #include "chrome/browser/password_manager/password_manager_delegate.h" |
| 13 #include "chrome/browser/password_manager/password_store.h" | 13 #include "chrome/browser/password_manager/password_store.h" |
| 14 #include "chrome/browser/password_manager/password_store_factory.h" | 14 #include "chrome/browser/password_manager/password_store_factory.h" |
| 15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
| 18 #include "content/public/browser/navigation_details.h" | 18 #include "content/public/browser/navigation_details.h" |
| 19 #include "content/public/common/frame_navigate_params.h" | 19 #include "content/public/common/frame_navigate_params.h" |
| 20 #include "content/public/test/test_browser_thread.h" | 20 #include "content/public/test/test_browser_thread.h" |
| 21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 using content::BrowserThread; | 24 using content::BrowserThread; |
| 25 using webkit::forms::PasswordForm; | 25 using content::PasswordForm; |
| 26 using testing::_; | 26 using testing::_; |
| 27 using testing::DoAll; | 27 using testing::DoAll; |
| 28 using ::testing::Exactly; | 28 using ::testing::Exactly; |
| 29 using ::testing::WithArg; | 29 using ::testing::WithArg; |
| 30 using ::testing::Return; | 30 using ::testing::Return; |
| 31 | 31 |
| 32 class MockPasswordManagerDelegate : public PasswordManagerDelegate { | 32 class MockPasswordManagerDelegate : public PasswordManagerDelegate { |
| 33 public: | 33 public: |
| 34 MOCK_METHOD1(FillPasswordForm, void( | 34 MOCK_METHOD1(FillPasswordForm, void( |
| 35 const webkit::forms::PasswordFormFillData&)); | 35 const PasswordFormFillData&)); |
| 36 MOCK_METHOD1(AddSavePasswordInfoBarIfPermitted, void(PasswordFormManager*)); | 36 MOCK_METHOD1(AddSavePasswordInfoBarIfPermitted, void(PasswordFormManager*)); |
| 37 MOCK_METHOD0(GetProfile, Profile*()); | 37 MOCK_METHOD0(GetProfile, Profile*()); |
| 38 MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool()); | 38 MOCK_METHOD0(DidLastPageLoadEncounterSSLErrors, bool()); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 ACTION_P2(InvokeConsumer, handle, forms) { | 41 ACTION_P2(InvokeConsumer, handle, forms) { |
| 42 arg0->OnPasswordStoreRequestDone(handle, forms); | 42 arg0->OnPasswordStoreRequestDone(handle, forms); |
| 43 } | 43 } |
| 44 | 44 |
| 45 ACTION_P(SaveToScopedPtr, scoped) { | 45 ACTION_P(SaveToScopedPtr, scoped) { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 std::vector<PasswordForm> observed; | 327 std::vector<PasswordForm> observed; |
| 328 PasswordForm form(MakeSimpleForm()); | 328 PasswordForm form(MakeSimpleForm()); |
| 329 observed.push_back(form); | 329 observed.push_back(form); |
| 330 manager()->OnPasswordFormsParsed(observed); // The initial load. | 330 manager()->OnPasswordFormsParsed(observed); // The initial load. |
| 331 observed.clear(); | 331 observed.clear(); |
| 332 manager()->OnPasswordFormsRendered(observed); // The initial layout. | 332 manager()->OnPasswordFormsRendered(observed); // The initial layout. |
| 333 | 333 |
| 334 manager()->OnPasswordFormsParsed(observed); // The post-navigation load. | 334 manager()->OnPasswordFormsParsed(observed); // The post-navigation load. |
| 335 manager()->OnPasswordFormsRendered(observed); // The post-navigation layout. | 335 manager()->OnPasswordFormsRendered(observed); // The post-navigation layout. |
| 336 } | 336 } |
| OLD | NEW |