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