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 3 // found in the LICENSE file. 4 5 #ifndef CHROME_TEST_BASE_CHROME_RENDER_VIEW_TEST_H_ 6 #define CHROME_TEST_BASE_CHROME_RENDER_VIEW_TEST_H_ 7 8 #include <memory> 9 #include <string> 10 11 #include "chrome/renderer/chrome_mock_render_thread.h" 12 #include "content/public/test/render_view_test.h" 13 #include "services/service_manager/public/cpp/binder_registry.h" 14 #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" 15 16 class ChromeContentRendererClient; 17 18 namespace autofill { 19 class AutofillAgent; 20 class TestPasswordAutofillAgent; 21 class PasswordGenerationAgent; 22 class AutofillAssistantAgent; 23 } // namespace autofill 24 25 class ChromeRenderViewTest : public content::RenderViewTest { 26 public: 27 ChromeRenderViewTest(); 28 ~ChromeRenderViewTest() override; 29 30 protected: 31 // testing::Test 32 void SetUp() override; 33 void TearDown() override; 34 content::ContentClient* CreateContentClient() override; 35 content::ContentBrowserClient* CreateContentBrowserClient() override; 36 content::ContentRendererClient* CreateContentRendererClient() override; 37 38 // Called from SetUp(). Override to register mojo interfaces. 39 virtual void RegisterMainFrameRemoteInterfaces(); 40 41 // Initializes commonly needed global state and renderer client parts. 42 // Use when overriding CreateContentRendererClient. 43 void InitChromeContentRendererClient(ChromeContentRendererClient* client); 44 45 void WaitForAutofillDidAssociateFormControl(); 46 47 autofill::TestPasswordAutofillAgent* password_autofill_agent_ = nullptr; 48 autofill::PasswordGenerationAgent* password_generation_ = nullptr; 49 autofill::AutofillAssistantAgent* autofill_assistant_agent_ = nullptr; 50 autofill::AutofillAgent* autofill_agent_ = nullptr; 51 52 std::unique_ptr<service_manager::BinderRegistry> registry_; 53 blink::AssociatedInterfaceRegistry associated_interfaces_; 54 55 // Naked pointer as ownership is with content::RenderViewTest::render_thread_. 56 ChromeMockRenderThread* chrome_render_thread_ = nullptr; 57 }; 58 59 #endif // CHROME_TEST_BASE_CHROME_RENDER_VIEW_TEST_H_ 60