| 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 "components/spellcheck/spellcheck_build_features.h" |
| 20 #include "content/public/browser/native_web_keyboard_event.h" | 21 #include "content/public/browser/native_web_keyboard_event.h" |
| 21 #include "content/public/common/renderer_preferences.h" | 22 #include "content/public/common/renderer_preferences.h" |
| 22 #include "content/public/renderer/render_view.h" | 23 #include "content/public/renderer/render_view.h" |
| 23 #include "extensions/features/features.h" | 24 #include "extensions/features/features.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
| 25 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 26 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 26 #include "third_party/WebKit/public/web/WebFrame.h" | 27 #include "third_party/WebKit/public/web/WebFrame.h" |
| 27 #include "third_party/WebKit/public/web/WebInputEvent.h" | 28 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 28 #include "third_party/WebKit/public/web/WebKit.h" | 29 #include "third_party/WebKit/public/web/WebKit.h" |
| 29 #include "third_party/WebKit/public/web/WebScriptController.h" | 30 #include "third_party/WebKit/public/web/WebScriptController.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 ChromeContentRendererClient* client) { | 166 ChromeContentRendererClient* client) { |
| 166 #if BUILDFLAG(ENABLE_EXTENSIONS) | 167 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 167 extension_dispatcher_delegate_.reset( | 168 extension_dispatcher_delegate_.reset( |
| 168 new ChromeExtensionsDispatcherDelegate()); | 169 new ChromeExtensionsDispatcherDelegate()); |
| 169 ChromeExtensionsRendererClient* ext_client = | 170 ChromeExtensionsRendererClient* ext_client = |
| 170 ChromeExtensionsRendererClient::GetInstance(); | 171 ChromeExtensionsRendererClient::GetInstance(); |
| 171 ext_client->SetExtensionDispatcherForTest( | 172 ext_client->SetExtensionDispatcherForTest( |
| 172 base::MakeUnique<extensions::Dispatcher>( | 173 base::MakeUnique<extensions::Dispatcher>( |
| 173 extension_dispatcher_delegate_.get())); | 174 extension_dispatcher_delegate_.get())); |
| 174 #endif | 175 #endif |
| 175 #if defined(ENABLE_SPELLCHECK) | 176 #if BUILDFLAG(ENABLE_SPELLCHECK) |
| 176 client->SetSpellcheck(new SpellCheck()); | 177 client->SetSpellcheck(new SpellCheck()); |
| 177 #endif | 178 #endif |
| 178 } | 179 } |
| 179 | 180 |
| 180 void ChromeRenderViewTest::EnableUserGestureSimulationForAutofill() { | 181 void ChromeRenderViewTest::EnableUserGestureSimulationForAutofill() { |
| 181 EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)), | 182 EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)), |
| 182 IsUserGesture()).WillRepeatedly(Return(true)); | 183 IsUserGesture()).WillRepeatedly(Return(true)); |
| 183 } | 184 } |
| 184 | 185 |
| 185 void ChromeRenderViewTest::DisableUserGestureSimulationForAutofill() { | 186 void ChromeRenderViewTest::DisableUserGestureSimulationForAutofill() { |
| 186 EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)), | 187 EXPECT_CALL(*(static_cast<MockAutofillAgent*>(autofill_agent_)), |
| 187 IsUserGesture()).WillRepeatedly(Return(false)); | 188 IsUserGesture()).WillRepeatedly(Return(false)); |
| 188 } | 189 } |
| 189 | 190 |
| 190 void ChromeRenderViewTest::WaitForAutofillDidAssociateFormControl() { | 191 void ChromeRenderViewTest::WaitForAutofillDidAssociateFormControl() { |
| 191 static_cast<MockAutofillAgent*>(autofill_agent_) | 192 static_cast<MockAutofillAgent*>(autofill_agent_) |
| 192 ->WaitForAutofillDidAssociateFormControl(); | 193 ->WaitForAutofillDidAssociateFormControl(); |
| 193 } | 194 } |
| 194 | 195 |
| 195 ChromeMockRenderThread* ChromeRenderViewTest::CreateMockRenderThread() { | 196 ChromeMockRenderThread* ChromeRenderViewTest::CreateMockRenderThread() { |
| 196 return new ChromeMockRenderThread(); | 197 return new ChromeMockRenderThread(); |
| 197 } | 198 } |
| OLD | NEW |