| 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 "content/public/test/render_view_test.h" | 5 #include "content/public/test/render_view_test.h" |
| 6 | 6 |
| 7 #include <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 using blink::WebLocalFrame; | 54 using blink::WebLocalFrame; |
| 55 using blink::WebMouseEvent; | 55 using blink::WebMouseEvent; |
| 56 using blink::WebScriptSource; | 56 using blink::WebScriptSource; |
| 57 using blink::WebString; | 57 using blink::WebString; |
| 58 using blink::WebURLRequest; | 58 using blink::WebURLRequest; |
| 59 | 59 |
| 60 namespace { | 60 namespace { |
| 61 | 61 |
| 62 const int32 kRouteId = 5; | 62 const int32 kRouteId = 5; |
| 63 const int32 kMainFrameRouteId = 6; | 63 const int32 kMainFrameRouteId = 6; |
| 64 // TODO(avi): Widget routing IDs should be distinct from the view routing IDs, |
| 65 // once RenderWidgetHost is distilled from RenderViewHostImpl. |
| 66 // https://crbug.com/545684 |
| 67 const int32_t kMainFrameWidgetRouteId = 5; |
| 64 const int32 kNewWindowRouteId = 7; | 68 const int32 kNewWindowRouteId = 7; |
| 65 const int32 kNewFrameRouteId = 10; | 69 const int32 kNewFrameRouteId = 10; |
| 70 const int32_t kNewFrameWidgetRouteId = 7; |
| 66 | 71 |
| 67 // Converts |ascii_character| into |key_code| and returns true on success. | 72 // Converts |ascii_character| into |key_code| and returns true on success. |
| 68 // Handles only the characters needed by tests. | 73 // Handles only the characters needed by tests. |
| 69 bool GetWindowsKeyCode(char ascii_character, int* key_code) { | 74 bool GetWindowsKeyCode(char ascii_character, int* key_code) { |
| 70 if (isalnum(ascii_character)) { | 75 if (isalnum(ascii_character)) { |
| 71 *key_code = base::ToUpperASCII(ascii_character); | 76 *key_code = base::ToUpperASCII(ascii_character); |
| 72 return true; | 77 return true; |
| 73 } | 78 } |
| 74 | 79 |
| 75 switch (ascii_character) { | 80 switch (ascii_character) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 SetContentClient(content_client_.get()); | 203 SetContentClient(content_client_.get()); |
| 199 SetBrowserClientForTesting(content_browser_client_.get()); | 204 SetBrowserClientForTesting(content_browser_client_.get()); |
| 200 SetRendererClientForTesting(content_renderer_client_.get()); | 205 SetRendererClientForTesting(content_renderer_client_.get()); |
| 201 | 206 |
| 202 // Subclasses can set render_thread_ with their own implementation before | 207 // Subclasses can set render_thread_ with their own implementation before |
| 203 // calling RenderViewTest::SetUp(). | 208 // calling RenderViewTest::SetUp(). |
| 204 if (!render_thread_) | 209 if (!render_thread_) |
| 205 render_thread_.reset(new MockRenderThread()); | 210 render_thread_.reset(new MockRenderThread()); |
| 206 render_thread_->set_routing_id(kRouteId); | 211 render_thread_->set_routing_id(kRouteId); |
| 207 render_thread_->set_new_window_routing_id(kNewWindowRouteId); | 212 render_thread_->set_new_window_routing_id(kNewWindowRouteId); |
| 213 render_thread_->set_new_window_main_frame_widget_routing_id( |
| 214 kNewFrameWidgetRouteId); |
| 208 render_thread_->set_new_frame_routing_id(kNewFrameRouteId); | 215 render_thread_->set_new_frame_routing_id(kNewFrameRouteId); |
| 209 | 216 |
| 210 #if defined(OS_MACOSX) | 217 #if defined(OS_MACOSX) |
| 211 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); | 218 autorelease_pool_.reset(new base::mac::ScopedNSAutoreleasePool()); |
| 212 #endif | 219 #endif |
| 213 command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM)); | 220 command_line_.reset(new base::CommandLine(base::CommandLine::NO_PROGRAM)); |
| 214 params_.reset(new MainFunctionParams(*command_line_)); | 221 params_.reset(new MainFunctionParams(*command_line_)); |
| 215 platform_.reset(new RendererMainPlatformDelegate(*params_)); | 222 platform_.reset(new RendererMainPlatformDelegate(*params_)); |
| 216 platform_->PlatformInitialize(); | 223 platform_->PlatformInitialize(); |
| 217 | 224 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 235 compositor_deps_.reset(new FakeCompositorDependencies); | 242 compositor_deps_.reset(new FakeCompositorDependencies); |
| 236 mock_process_.reset(new MockRenderProcess); | 243 mock_process_.reset(new MockRenderProcess); |
| 237 | 244 |
| 238 ViewMsg_New_Params view_params; | 245 ViewMsg_New_Params view_params; |
| 239 view_params.opener_frame_route_id = MSG_ROUTING_NONE; | 246 view_params.opener_frame_route_id = MSG_ROUTING_NONE; |
| 240 view_params.window_was_created_with_opener = false; | 247 view_params.window_was_created_with_opener = false; |
| 241 view_params.renderer_preferences = RendererPreferences(); | 248 view_params.renderer_preferences = RendererPreferences(); |
| 242 view_params.web_preferences = WebPreferences(); | 249 view_params.web_preferences = WebPreferences(); |
| 243 view_params.view_id = kRouteId; | 250 view_params.view_id = kRouteId; |
| 244 view_params.main_frame_routing_id = kMainFrameRouteId; | 251 view_params.main_frame_routing_id = kMainFrameRouteId; |
| 252 view_params.main_frame_widget_routing_id = kMainFrameWidgetRouteId; |
| 245 view_params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId; | 253 view_params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId; |
| 246 view_params.swapped_out = false; | 254 view_params.swapped_out = false; |
| 247 view_params.replicated_frame_state = FrameReplicationState(); | 255 view_params.replicated_frame_state = FrameReplicationState(); |
| 248 view_params.proxy_routing_id = MSG_ROUTING_NONE; | 256 view_params.proxy_routing_id = MSG_ROUTING_NONE; |
| 249 view_params.hidden = false; | 257 view_params.hidden = false; |
| 250 view_params.never_visible = false; | 258 view_params.never_visible = false; |
| 251 view_params.next_page_id = 1; | 259 view_params.next_page_id = 1; |
| 252 view_params.initial_size = *InitialSizeParams(); | 260 view_params.initial_size = *InitialSizeParams(); |
| 253 view_params.enable_auto_resize = false; | 261 view_params.enable_auto_resize = false; |
| 254 view_params.min_size = gfx::Size(); | 262 view_params.min_size = gfx::Size(); |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 TestRenderFrame* frame = | 600 TestRenderFrame* frame = |
| 593 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); | 601 static_cast<TestRenderFrame*>(impl->GetMainRenderFrame()); |
| 594 frame->Navigate(common_params, StartNavigationParams(), request_params); | 602 frame->Navigate(common_params, StartNavigationParams(), request_params); |
| 595 | 603 |
| 596 // The load actually happens asynchronously, so we pump messages to process | 604 // The load actually happens asynchronously, so we pump messages to process |
| 597 // the pending continuation. | 605 // the pending continuation. |
| 598 FrameLoadWaiter(frame).Wait(); | 606 FrameLoadWaiter(frame).Wait(); |
| 599 } | 607 } |
| 600 | 608 |
| 601 } // namespace content | 609 } // namespace content |
| OLD | NEW |