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.
5 #include "chrome/test/base/chrome_render_view_test.h"
7 #include "chrome/browser/extensions/extension_function_dispatcher.h"
8 #include "chrome/common/render_messages.h"
9 #include "chrome/renderer/extensions/chrome_v8_context_set.h"
10 #include "chrome/renderer/extensions/chrome_v8_extension.h"
11 #include "chrome/renderer/extensions/dispatcher.h"
12 #include "chrome/renderer/extensions/event_bindings.h"
13 #include "chrome/renderer/spellchecker/spellcheck.h"
14 #include "components/autofill/content/renderer/autofill_agent.h"
15 #include "components/autofill/content/renderer/password_autofill_agent.h"
16 #include "components/autofill/content/renderer/test_password_autofill_agent.h"
17 #include "content/public/browser/native_web_keyboard_event.h"
18 #include "content/public/common/renderer_preferences.h"
19 #include "content/public/renderer/render_view.h"
20 #include "extensions/common/extension.h"
21 #include "grit/renderer_resources.h"
22 #include "third_party/WebKit/public/platform/WebURLRequest.h"
23 #include "third_party/WebKit/public/web/WebFrame.h"
24 #include "third_party/WebKit/public/web/WebInputEvent.h"
25 #include "third_party/WebKit/public/web/WebKit.h"
26 #include "third_party/WebKit/public/web/WebScriptController.h"
27 #include "third_party/WebKit/public/web/WebScriptSource.h"
28 #include "third_party/WebKit/public/web/WebView.h"
30 #if defined(OS_LINUX) && !defined(USE_AURA)
31 #include "ui/base/gtk/event_synthesis_gtk.h"
34 using blink::WebFrame
;
35 using blink::WebInputEvent
;
36 using blink::WebMouseEvent
;
37 using blink::WebScriptController
;
38 using blink::WebScriptSource
;
39 using blink::WebString
;
40 using blink::WebURLRequest
;
41 using autofill::AutofillAgent
;
42 using autofill::PasswordAutofillAgent
;
44 ChromeRenderViewTest::ChromeRenderViewTest() : extension_dispatcher_(NULL
) {
47 ChromeRenderViewTest::~ChromeRenderViewTest() {
50 void ChromeRenderViewTest::SetUp() {
51 chrome_render_thread_
= new ChromeMockRenderThread();
52 render_thread_
.reset(chrome_render_thread_
);
54 content::SetRendererClientForTesting(&chrome_content_renderer_client_
);
55 extension_dispatcher_
= new extensions::Dispatcher();
56 chrome_content_renderer_client_
.SetExtensionDispatcher(extension_dispatcher_
);
57 #if defined(ENABLE_SPELLCHECK)
58 chrome_content_renderer_client_
.SetSpellcheck(new SpellCheck());
61 content::RenderViewTest::SetUp();
63 // RenderView doesn't expose its PasswordAutofillAgent or AutofillAgent
64 // objects, because it has no need to store them directly (they're stored as
65 // RenderViewObserver*). So just create another set.
66 password_autofill_
= new autofill::TestPasswordAutofillAgent(view_
);
67 autofill_agent_
= new AutofillAgent(view_
, password_autofill_
);
70 void ChromeRenderViewTest::TearDown() {
71 extension_dispatcher_
->OnRenderProcessShutdown();
72 extension_dispatcher_
= NULL
;
74 content::RenderViewTest::TearDown();