Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / chrome / test / base / chrome_render_view_test.cc
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 #include "chrome/test/base/chrome_render_view_test.h"
6
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 "components/autofill/content/renderer/test_password_generation_agent.h"
18 #include "content/public/browser/native_web_keyboard_event.h"
19 #include "content/public/common/renderer_preferences.h"
20 #include "content/public/renderer/render_view.h"
21 #include "extensions/common/extension.h"
22 #include "grit/renderer_resources.h"
23 #include "third_party/WebKit/public/platform/WebURLRequest.h"
24 #include "third_party/WebKit/public/web/WebFrame.h"
25 #include "third_party/WebKit/public/web/WebInputEvent.h"
26 #include "third_party/WebKit/public/web/WebKit.h"
27 #include "third_party/WebKit/public/web/WebScriptController.h"
28 #include "third_party/WebKit/public/web/WebScriptSource.h"
29 #include "third_party/WebKit/public/web/WebView.h"
30
31 #if defined(OS_LINUX) && !defined(USE_AURA)
32 #include "ui/base/gtk/event_synthesis_gtk.h"
33 #endif
34
35 using blink::WebFrame;
36 using blink::WebInputEvent;
37 using blink::WebMouseEvent;
38 using blink::WebScriptController;
39 using blink::WebScriptSource;
40 using blink::WebString;
41 using blink::WebURLRequest;
42 using autofill::AutofillAgent;
43 using autofill::PasswordAutofillAgent;
44 using autofill::PasswordGenerationAgent;
45
46 ChromeRenderViewTest::ChromeRenderViewTest() : extension_dispatcher_(NULL) {
47 }
48
49 ChromeRenderViewTest::~ChromeRenderViewTest() {
50 }
51
52 void ChromeRenderViewTest::SetUp() {
53   chrome_render_thread_ = new ChromeMockRenderThread();
54   render_thread_.reset(chrome_render_thread_);
55
56   content::SetRendererClientForTesting(&chrome_content_renderer_client_);
57   extension_dispatcher_ = new extensions::Dispatcher();
58   chrome_content_renderer_client_.SetExtensionDispatcher(extension_dispatcher_);
59 #if defined(ENABLE_SPELLCHECK)
60   chrome_content_renderer_client_.SetSpellcheck(new SpellCheck());
61 #endif
62
63   content::RenderViewTest::SetUp();
64
65   // RenderView doesn't expose its Agent objects, because it has no need to
66   // store them directly (they're stored as RenderViewObserver*).  So just
67   // create another set.
68   password_autofill_ = new autofill::TestPasswordAutofillAgent(view_);
69   password_generation_ = new autofill::TestPasswordGenerationAgent(view_);
70   autofill_agent_ =
71       new AutofillAgent(view_, password_autofill_, password_generation_);
72 }
73
74 void ChromeRenderViewTest::TearDown() {
75   extension_dispatcher_->OnRenderProcessShutdown();
76   extension_dispatcher_ = NULL;
77
78   content::RenderViewTest::TearDown();
79 }