| 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 "content/test/render_view_test.h" | 5 #include "content/test/render_view_test.h" |
| 6 | 6 |
| 7 #include "content/common/dom_storage_common.h" | 7 #include "content/common/dom_storage_common.h" |
| 8 #include "content/common/view_messages.h" | 8 #include "content/common/view_messages.h" |
| 9 #include "content/public/browser/native_web_keyboard_event.h" | 9 #include "content/public/browser/native_web_keyboard_event.h" |
| 10 #include "content/public/common/renderer_preferences.h" | 10 #include "content/public/common/renderer_preferences.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 using WebKit::WebFrame; | 38 using WebKit::WebFrame; |
| 39 using WebKit::WebInputEvent; | 39 using WebKit::WebInputEvent; |
| 40 using WebKit::WebMouseEvent; | 40 using WebKit::WebMouseEvent; |
| 41 using WebKit::WebScriptController; | 41 using WebKit::WebScriptController; |
| 42 using WebKit::WebScriptSource; | 42 using WebKit::WebScriptSource; |
| 43 using WebKit::WebString; | 43 using WebKit::WebString; |
| 44 using WebKit::WebURLRequest; | 44 using WebKit::WebURLRequest; |
| 45 | 45 |
| 46 namespace { | 46 namespace { |
| 47 const int32 kOpenerId = 7; | 47 const int32 kOpenerId = -2; |
| 48 const int32 kRouteId = 5; | 48 const int32 kRouteId = 5; |
| 49 | 49 |
| 50 #if defined(USE_AURA) && defined(USE_X11) | 50 #if defined(USE_AURA) && defined(USE_X11) |
| 51 // Converts MockKeyboard::Modifiers to ui::EventFlags. | 51 // Converts MockKeyboard::Modifiers to ui::EventFlags. |
| 52 int ConvertMockKeyboardModifier(MockKeyboard::Modifiers modifiers) { | 52 int ConvertMockKeyboardModifier(MockKeyboard::Modifiers modifiers) { |
| 53 static struct ModifierMap { | 53 static struct ModifierMap { |
| 54 MockKeyboard::Modifiers src; | 54 MockKeyboard::Modifiers src; |
| 55 int dst; | 55 int dst; |
| 56 } kModifierMap[] = { | 56 } kModifierMap[] = { |
| 57 { MockKeyboard::LEFT_SHIFT, ui::EF_SHIFT_DOWN }, | 57 { MockKeyboard::LEFT_SHIFT, ui::EF_SHIFT_DOWN }, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 // This needs to pass the mock render thread to the view. | 146 // This needs to pass the mock render thread to the view. |
| 147 RenderViewImpl* view = RenderViewImpl::Create( | 147 RenderViewImpl* view = RenderViewImpl::Create( |
| 148 0, | 148 0, |
| 149 kOpenerId, | 149 kOpenerId, |
| 150 content::RendererPreferences(), | 150 content::RendererPreferences(), |
| 151 WebPreferences(), | 151 WebPreferences(), |
| 152 new SharedRenderViewCounter(0), | 152 new SharedRenderViewCounter(0), |
| 153 kRouteId, | 153 kRouteId, |
| 154 kInvalidSessionStorageNamespaceId, | 154 kInvalidSessionStorageNamespaceId, |
| 155 string16(), | 155 string16(), |
| 156 false /* is_renderer_created */, |
| 156 1); | 157 1); |
| 157 view->AddRef(); | 158 view->AddRef(); |
| 158 view_ = view; | 159 view_ = view; |
| 159 | 160 |
| 160 // Attach a pseudo keyboard device to this object. | 161 // Attach a pseudo keyboard device to this object. |
| 161 mock_keyboard_.reset(new MockKeyboard()); | 162 mock_keyboard_.reset(new MockKeyboard()); |
| 162 } | 163 } |
| 163 | 164 |
| 164 void RenderViewTest::TearDown() { | 165 void RenderViewTest::TearDown() { |
| 165 // Try very hard to collect garbage before shutting down. | 166 // Try very hard to collect garbage before shutting down. |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 430 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 430 impl->set_send_content_state_immediately(true); | 431 impl->set_send_content_state_immediately(true); |
| 431 } | 432 } |
| 432 | 433 |
| 433 WebKit::WebWidget* RenderViewTest::GetWebWidget() { | 434 WebKit::WebWidget* RenderViewTest::GetWebWidget() { |
| 434 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); | 435 RenderViewImpl* impl = static_cast<RenderViewImpl*>(view_); |
| 435 return impl->webwidget(); | 436 return impl->webwidget(); |
| 436 } | 437 } |
| 437 | 438 |
| 438 } // namespace content | 439 } // namespace content |
| OLD | NEW |