| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/render_view_test.h" | 5 #include "chrome/test/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/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "chrome/common/gfx_resource_provider.h" | 9 #include "chrome/common/gfx_resource_provider.h" |
| 10 #include "chrome/common/print_messages.h" | 10 #include "chrome/common/print_messages.h" |
| 11 #include "chrome/common/render_messages.h" | 11 #include "chrome/common/render_messages.h" |
| 12 #include "chrome/renderer/autofill/autofill_agent.h" | 12 #include "chrome/renderer/autofill/autofill_agent.h" |
| 13 #include "chrome/renderer/autofill/password_autofill_manager.h" | 13 #include "chrome/renderer/autofill/password_autofill_manager.h" |
| 14 #include "chrome/renderer/extensions/event_bindings.h" | 14 #include "chrome/renderer/extensions/event_bindings.h" |
| 15 #include "chrome/renderer/extensions/extension_process_bindings.h" | 15 #include "chrome/renderer/extensions/extension_process_bindings.h" |
| 16 #include "chrome/renderer/extensions/js_only_v8_extensions.h" | 16 #include "chrome/renderer/extensions/js_only_v8_extensions.h" |
| 17 #include "chrome/renderer/extensions/renderer_extension_bindings.h" | 17 #include "chrome/renderer/extensions/renderer_extension_bindings.h" |
| 18 #include "chrome/renderer/mock_render_process.h" | 18 #include "chrome/renderer/mock_render_process.h" |
| 19 #include "chrome/renderer/print_web_view_helper.h" |
| 19 #include "chrome/renderer/renderer_main_platform_delegate.h" | 20 #include "chrome/renderer/renderer_main_platform_delegate.h" |
| 20 #include "content/common/dom_storage_common.h" | 21 #include "content/common/dom_storage_common.h" |
| 21 #include "content/common/native_web_keyboard_event.h" | 22 #include "content/common/native_web_keyboard_event.h" |
| 22 #include "content/common/renderer_preferences.h" | 23 #include "content/common/renderer_preferences.h" |
| 23 #include "content/common/view_messages.h" | 24 #include "content/common/view_messages.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptController.h
" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 for (size_t i = 0; i < Extension::kNumPermissions; ++i) | 129 for (size_t i = 0; i < Extension::kNumPermissions; ++i) |
| 129 all_permissions.insert(Extension::kPermissions[i].name); | 130 all_permissions.insert(Extension::kPermissions[i].name); |
| 130 ExtensionProcessBindings::SetAPIPermissions("", all_permissions); | 131 ExtensionProcessBindings::SetAPIPermissions("", all_permissions); |
| 131 | 132 |
| 132 mock_process_.reset(new MockRenderProcess); | 133 mock_process_.reset(new MockRenderProcess); |
| 133 | 134 |
| 134 render_thread_.set_routing_id(kRouteId); | 135 render_thread_.set_routing_id(kRouteId); |
| 135 | 136 |
| 136 // This needs to pass the mock render thread to the view. | 137 // This needs to pass the mock render thread to the view. |
| 137 view_ = RenderView::Create(&render_thread_, | 138 view_ = RenderView::Create(&render_thread_, |
| 138 0, | |
| 139 kOpenerId, | |
| 140 RendererPreferences(), | |
| 141 WebPreferences(), | 139 WebPreferences(), |
| 142 new SharedRenderViewCounter(0), | 140 new SharedRenderViewCounter(0), |
| 143 kRouteId, | 141 kRouteId, |
| 144 kInvalidSessionStorageNamespaceId, | 142 kInvalidSessionStorageNamespaceId); |
| 145 string16()); | 143 view_->Init(0, kOpenerId, RendererPreferences(), string16(), NULL, NULL); |
| 146 | 144 |
| 147 // Attach a pseudo keyboard device to this object. | 145 // Attach a pseudo keyboard device to this object. |
| 148 mock_keyboard_.reset(new MockKeyboard()); | 146 mock_keyboard_.reset(new MockKeyboard()); |
| 149 | 147 |
| 150 // RenderView doesn't expose it's PasswordAutofillManager or | 148 // These RenderViewObserver are normally created in RenderViewWrapper. |
| 151 // AutofillAgent objects, because it has no need to store them directly | 149 // Manually creating them here. |
| 152 // (they're stored as RenderViewObserver*). So just create another set. | |
| 153 password_autofill_ = new PasswordAutofillManager(view_); | 150 password_autofill_ = new PasswordAutofillManager(view_); |
| 154 autofill_agent_ = new AutofillAgent(view_, password_autofill_); | 151 autofill_agent_ = new AutofillAgent(view_, password_autofill_); |
| 152 print_helper_ = new PrintWebViewHelper(view_); |
| 155 } | 153 } |
| 156 | 154 |
| 157 void RenderViewTest::TearDown() { | 155 void RenderViewTest::TearDown() { |
| 158 // Try very hard to collect garbage before shutting down. | 156 // Try very hard to collect garbage before shutting down. |
| 159 GetMainFrame()->collectGarbage(); | 157 GetMainFrame()->collectGarbage(); |
| 160 GetMainFrame()->collectGarbage(); | 158 GetMainFrame()->collectGarbage(); |
| 161 | 159 |
| 162 render_thread_.SendCloseMessage(); | 160 render_thread_.SendCloseMessage(); |
| 163 | 161 |
| 164 // Run the loop so the release task from the renderwidget executes. | 162 // Run the loop so the release task from the renderwidget executes. |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 mouse_event.x = bounds.CenterPoint().x(); | 354 mouse_event.x = bounds.CenterPoint().x(); |
| 357 mouse_event.y = bounds.CenterPoint().y(); | 355 mouse_event.y = bounds.CenterPoint().y(); |
| 358 mouse_event.clickCount = 1; | 356 mouse_event.clickCount = 1; |
| 359 ViewMsg_HandleInputEvent input_event(0); | 357 ViewMsg_HandleInputEvent input_event(0); |
| 360 scoped_ptr<IPC::Message> input_message(new ViewMsg_HandleInputEvent(0)); | 358 scoped_ptr<IPC::Message> input_message(new ViewMsg_HandleInputEvent(0)); |
| 361 input_message->WriteData(reinterpret_cast<const char*>(&mouse_event), | 359 input_message->WriteData(reinterpret_cast<const char*>(&mouse_event), |
| 362 sizeof(WebMouseEvent)); | 360 sizeof(WebMouseEvent)); |
| 363 view_->OnMessageReceived(*input_message); | 361 view_->OnMessageReceived(*input_message); |
| 364 return true; | 362 return true; |
| 365 } | 363 } |
| OLD | NEW |