blob: 1f1067b3c27886cd5eb5ce56dd827948924c49b5 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_TEST_BASE_CHROME_RENDER_VIEW_TEST_H_
#define CHROME_TEST_BASE_CHROME_RENDER_VIEW_TEST_H_
#include <memory>
#include <string>
#include "chrome/renderer/chrome_mock_render_thread.h"
#include "content/public/test/render_view_test.h"
#include "extensions/features/features.h"
class ChromeContentRendererClient;
namespace autofill {
class AutofillAgent;
class TestPasswordAutofillAgent;
class TestPasswordGenerationAgent;
}
namespace extensions {
class DispatcherDelegate;
}
class ChromeRenderViewTest : public content::RenderViewTest {
public:
ChromeRenderViewTest();
~ChromeRenderViewTest() override;
protected:
// testing::Test
void SetUp() override;
void TearDown() override;
content::ContentClient* CreateContentClient() override;
content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentRendererClient* CreateContentRendererClient() override;
// Called from SetUp(). Override to register mojo interfaces.
virtual void RegisterMainFrameRemoteInterfaces();
// Initializes commonly needed global state and renderer client parts.
// Use when overriding CreateContentRendererClient.
void InitChromeContentRendererClient(ChromeContentRendererClient* client);
void EnableUserGestureSimulationForAutofill();
void DisableUserGestureSimulationForAutofill();
void WaitForAutofillDidAssociateFormControl();
// Tests which need to handle IPC's sent to the browser should override
// this method and return a subclass of ChromeMockRenderThread.
// The ChromeMockRenderThread pointer is owned by the ChromeRenderViewTest
// class.
virtual ChromeMockRenderThread* CreateMockRenderThread();
#if BUILDFLAG(ENABLE_EXTENSIONS)
std::unique_ptr<extensions::DispatcherDelegate>
extension_dispatcher_delegate_;
#endif
autofill::TestPasswordAutofillAgent* password_autofill_agent_;
autofill::TestPasswordGenerationAgent* password_generation_;
autofill::AutofillAgent* autofill_agent_;
// Naked pointer as ownership is with content::RenderViewTest::render_thread_.
ChromeMockRenderThread* chrome_render_thread_;
};
#endif // CHROME_TEST_BASE_CHROME_RENDER_VIEW_TEST_H_