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 "base/debug/leak_annotations.h" | 7 #include "base/debug/leak_annotations.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "chrome/browser/chrome_content_browser_client.h" | 11 #include "chrome/browser/chrome_content_browser_client.h" |
12 #include "chrome/common/chrome_content_client.h" | 12 #include "chrome/common/chrome_content_client.h" |
13 #include "chrome/renderer/chrome_content_renderer_client.h" | 13 #include "chrome/renderer/chrome_content_renderer_client.h" |
14 #include "chrome/test/base/chrome_unit_test_suite.h" | 14 #include "chrome/test/base/chrome_unit_test_suite.h" |
15 #include "components/autofill/content/renderer/autofill_agent.h" | 15 #include "components/autofill/content/renderer/autofill_agent.h" |
16 #include "components/autofill/content/renderer/password_autofill_agent.h" | 16 #include "components/autofill/content/renderer/password_autofill_agent.h" |
17 #include "components/autofill/content/renderer/test_password_autofill_agent.h" | 17 #include "components/autofill/content/renderer/test_password_autofill_agent.h" |
18 #include "components/autofill/content/renderer/test_password_generation_agent.h" | 18 #include "components/autofill/content/renderer/test_password_generation_agent.h" |
19 #include "components/spellcheck/renderer/spellcheck.h" | 19 #include "components/spellcheck/renderer/spellcheck.h" |
20 #include "content/public/browser/native_web_keyboard_event.h" | 20 #include "content/public/browser/native_web_keyboard_event.h" |
21 #include "content/public/common/renderer_preferences.h" | 21 #include "content/public/common/renderer_preferences.h" |
22 #include "content/public/renderer/render_view.h" | 22 #include "content/public/renderer/render_view.h" |
| 23 #include "extensions/features/features.h" |
23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
24 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 25 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
25 #include "third_party/WebKit/public/web/WebFrame.h" | 26 #include "third_party/WebKit/public/web/WebFrame.h" |
26 #include "third_party/WebKit/public/web/WebInputEvent.h" | 27 #include "third_party/WebKit/public/web/WebInputEvent.h" |
27 #include "third_party/WebKit/public/web/WebKit.h" | 28 #include "third_party/WebKit/public/web/WebKit.h" |
28 #include "third_party/WebKit/public/web/WebScriptController.h" | 29 #include "third_party/WebKit/public/web/WebScriptController.h" |
29 #include "third_party/WebKit/public/web/WebScriptSource.h" | 30 #include "third_party/WebKit/public/web/WebScriptSource.h" |
30 #include "third_party/WebKit/public/web/WebView.h" | 31 #include "third_party/WebKit/public/web/WebView.h" |
31 | 32 |
32 #if defined(ENABLE_EXTENSIONS) | 33 #if BUILDFLAG(ENABLE_EXTENSIONS) |
33 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" | 34 #include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h" |
34 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" | 35 #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" |
35 #include "extensions/browser/extension_function_dispatcher.h" | 36 #include "extensions/browser/extension_function_dispatcher.h" |
36 #include "extensions/common/extension.h" | 37 #include "extensions/common/extension.h" |
37 #include "extensions/renderer/dispatcher.h" | 38 #include "extensions/renderer/dispatcher.h" |
38 #include "extensions/renderer/event_bindings.h" | 39 #include "extensions/renderer/event_bindings.h" |
39 #endif | 40 #endif |
40 | 41 |
41 using autofill::AutofillAgent; | 42 using autofill::AutofillAgent; |
42 using autofill::PasswordAutofillAgent; | 43 using autofill::PasswordAutofillAgent; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 password_generation_ = | 122 password_generation_ = |
122 new autofill::TestPasswordGenerationAgent(view_->GetMainRenderFrame(), | 123 new autofill::TestPasswordGenerationAgent(view_->GetMainRenderFrame(), |
123 password_autofill_agent_); | 124 password_autofill_agent_); |
124 autofill_agent_ = new NiceMock<MockAutofillAgent>(view_->GetMainRenderFrame(), | 125 autofill_agent_ = new NiceMock<MockAutofillAgent>(view_->GetMainRenderFrame(), |
125 password_autofill_agent_, | 126 password_autofill_agent_, |
126 password_generation_); | 127 password_generation_); |
127 } | 128 } |
128 | 129 |
129 void ChromeRenderViewTest::TearDown() { | 130 void ChromeRenderViewTest::TearDown() { |
130 base::RunLoop().RunUntilIdle(); | 131 base::RunLoop().RunUntilIdle(); |
131 #if defined(ENABLE_EXTENSIONS) | 132 #if BUILDFLAG(ENABLE_EXTENSIONS) |
132 ChromeExtensionsRendererClient* ext_client = | 133 ChromeExtensionsRendererClient* ext_client = |
133 ChromeExtensionsRendererClient::GetInstance(); | 134 ChromeExtensionsRendererClient::GetInstance(); |
134 ext_client->GetExtensionDispatcherForTest()->OnRenderProcessShutdown(); | 135 ext_client->GetExtensionDispatcherForTest()->OnRenderProcessShutdown(); |
135 #endif | 136 #endif |
136 | 137 |
137 #if defined(LEAK_SANITIZER) | 138 #if defined(LEAK_SANITIZER) |
138 // Do this before shutting down V8 in RenderViewTest::TearDown(). | 139 // Do this before shutting down V8 in RenderViewTest::TearDown(). |
139 // http://crbug.com/328552 | 140 // http://crbug.com/328552 |
140 __lsan_do_leak_check(); | 141 __lsan_do_leak_check(); |
141 #endif | 142 #endif |
(...skipping 13 matching lines...) Expand all Loading... |
155 ChromeRenderViewTest::CreateContentRendererClient() { | 156 ChromeRenderViewTest::CreateContentRendererClient() { |
156 ChromeContentRendererClient* client = new ChromeContentRendererClient(); | 157 ChromeContentRendererClient* client = new ChromeContentRendererClient(); |
157 InitChromeContentRendererClient(client); | 158 InitChromeContentRendererClient(client); |
158 return client; | 159 return client; |
159 } | 160 } |
160 | 161 |
161 void ChromeRenderViewTest::RegisterMainFrameRemoteInterfaces() {} | 162 void ChromeRenderViewTest::RegisterMainFrameRemoteInterfaces() {} |
162 | 163 |
163 void ChromeRenderViewTest::InitChromeContentRendererClient( | 164 void ChromeRenderViewTest::InitChromeContentRendererClient( |
164 ChromeContentRendererClient* client) { | 165 ChromeContentRendererClient* client) { |
165 #if defined(ENABLE_EXTENSIONS) | 166 #if BUILDFLAG(ENABLE_EXTENSIONS) |
166 extension_dispatcher_delegate_.reset( | 167 extension_dispatcher_delegate_.reset( |
167 new ChromeExtensionsDispatcherDelegate()); | 168 new ChromeExtensionsDispatcherDelegate()); |
168 ChromeExtensionsRendererClient* ext_client = | 169 ChromeExtensionsRendererClient* ext_client = |
169 ChromeExtensionsRendererClient::GetInstance(); | 170 ChromeExtensionsRendererClient::GetInstance(); |
170 ext_client->SetExtensionDispatcherForTest( | 171 ext_client->SetExtensionDispatcherForTest( |
171 base::MakeUnique<extensions::Dispatcher>( | 172 base::MakeUnique<extensions::Dispatcher>( |
172 extension_dispatcher_delegate_.get())); | 173 extension_dispatcher_delegate_.get())); |
173 #endif | 174 #endif |
174 #if defined(ENABLE_SPELLCHECK) | 175 #if defined(ENABLE_SPELLCHECK) |
175 client->SetSpellcheck(new SpellCheck()); | 176 client->SetSpellcheck(new SpellCheck()); |
(...skipping 11 matching lines...) Expand all Loading... |
187 } | 188 } |
188 | 189 |
189 void ChromeRenderViewTest::WaitForAutofillDidAssociateFormControl() { | 190 void ChromeRenderViewTest::WaitForAutofillDidAssociateFormControl() { |
190 static_cast<MockAutofillAgent*>(autofill_agent_) | 191 static_cast<MockAutofillAgent*>(autofill_agent_) |
191 ->WaitForAutofillDidAssociateFormControl(); | 192 ->WaitForAutofillDidAssociateFormControl(); |
192 } | 193 } |
193 | 194 |
194 ChromeMockRenderThread* ChromeRenderViewTest::CreateMockRenderThread() { | 195 ChromeMockRenderThread* ChromeRenderViewTest::CreateMockRenderThread() { |
195 return new ChromeMockRenderThread(); | 196 return new ChromeMockRenderThread(); |
196 } | 197 } |
OLD | NEW |