Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 explicit MockAutofillDriver(content::WebContents* web_contents) | 39 explicit MockAutofillDriver(content::WebContents* web_contents) |
| 40 : TestAutofillDriver(web_contents) {} | 40 : TestAutofillDriver(web_contents) {} |
| 41 | 41 |
| 42 // Mock methods to enable testability. | 42 // Mock methods to enable testability. |
| 43 MOCK_METHOD1(SetRendererActionOnFormDataReception, | 43 MOCK_METHOD1(SetRendererActionOnFormDataReception, |
| 44 void(RendererFormDataAction action)); | 44 void(RendererFormDataAction action)); |
| 45 MOCK_METHOD1(RendererShouldAcceptDataListSuggestion, | 45 MOCK_METHOD1(RendererShouldAcceptDataListSuggestion, |
| 46 void(const base::string16&)); | 46 void(const base::string16&)); |
| 47 MOCK_METHOD0(RendererShouldClearFilledForm, void()); | 47 MOCK_METHOD0(RendererShouldClearFilledForm, void()); |
| 48 MOCK_METHOD0(RendererShouldClearPreviewedForm, void()); | 48 MOCK_METHOD0(RendererShouldClearPreviewedForm, void()); |
| 49 MOCK_METHOD1(RendererShouldSetNodeText, void(const base::string16&)); | |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 DISALLOW_COPY_AND_ASSIGN(MockAutofillDriver); | 52 DISALLOW_COPY_AND_ASSIGN(MockAutofillDriver); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 class MockAutofillManagerDelegate | 55 class MockAutofillManagerDelegate |
| 55 : public autofill::TestAutofillManagerDelegate { | 56 : public autofill::TestAutofillManagerDelegate { |
| 56 public: | 57 public: |
| 57 MockAutofillManagerDelegate() {} | 58 MockAutofillManagerDelegate() {} |
| 58 | 59 |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 477 // anything. | 478 // anything. |
| 478 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); | 479 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); |
| 479 | 480 |
| 480 external_delegate_->OnSuggestionsReturned(kQueryId, | 481 external_delegate_->OnSuggestionsReturned(kQueryId, |
| 481 autofill_items, | 482 autofill_items, |
| 482 autofill_items, | 483 autofill_items, |
| 483 autofill_items, | 484 autofill_items, |
| 484 autofill_ids); | 485 autofill_ids); |
| 485 } | 486 } |
| 486 | 487 |
| 488 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateSetNodeText) { | |
| 489 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); | |
| 490 base::string16 dummyString(ASCIIToUTF16("baz foo")); | |
|
Ilya Sherman
2013/11/14 01:26:14
nit: "dummyString" -> "dummy_string" (i.e. use hac
jif-google
2013/11/14 13:52:04
Done.
| |
| 491 EXPECT_CALL(*autofill_driver_, | |
| 492 RendererShouldSetNodeText(dummyString)); | |
| 493 external_delegate_->DidAcceptSuggestion( | |
| 494 dummyString, | |
| 495 WebAutofillClient::MenuItemIDAutocompleteEntry); | |
| 496 } | |
| 497 | |
| 487 } // namespace autofill | 498 } // namespace autofill |
| OLD | NEW |