| 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_fake_resources_test.h" | 5 #include "content/public/test/render_view_fake_resources_test.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| 11 #include "base/process/process.h" | 11 #include "base/process/process.h" |
| 12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "content/common/dom_storage/dom_storage_types.h" |
| 14 #include "content/common/resource_messages.h" | 15 #include "content/common/resource_messages.h" |
| 15 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
| 16 #include "content/public/common/resource_response.h" | 17 #include "content/public/common/resource_response.h" |
| 17 #include "content/public/renderer/history_item_serialization.h" | 18 #include "content/public/renderer/history_item_serialization.h" |
| 18 #include "content/renderer/render_thread_impl.h" | 19 #include "content/renderer/render_thread_impl.h" |
| 19 #include "content/renderer/render_view_impl.h" | 20 #include "content/renderer/render_view_impl.h" |
| 20 #include "content/renderer/renderer_webkitplatformsupport_impl.h" | 21 #include "content/renderer/renderer_webkitplatformsupport_impl.h" |
| 21 #include "content/test/mock_render_process.h" | 22 #include "content/test/mock_render_process.h" |
| 22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 23 #include "net/base/upload_data.h" | 24 #include "net/base/upload_data.h" |
| 24 #include "net/http/http_response_headers.h" | 25 #include "net/http/http_response_headers.h" |
| 25 #include "net/url_request/url_request_status.h" | 26 #include "net/url_request/url_request_status.h" |
| 26 #include "third_party/WebKit/public/platform/WebString.h" | 27 #include "third_party/WebKit/public/platform/WebString.h" |
| 27 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 28 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 28 #include "third_party/WebKit/public/web/WebFrame.h" | 29 #include "third_party/WebKit/public/web/WebFrame.h" |
| 29 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 30 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 30 #include "third_party/WebKit/public/web/WebView.h" | 31 #include "third_party/WebKit/public/web/WebView.h" |
| 31 #include "ui/base/ui_base_switches.h" | 32 #include "ui/base/ui_base_switches.h" |
| 32 #include "url/gurl.h" | 33 #include "url/gurl.h" |
| 33 #include "webkit/common/dom_storage/dom_storage_types.h" | |
| 34 #include "webkit/glue/webkit_glue.h" | 34 #include "webkit/glue/webkit_glue.h" |
| 35 | 35 |
| 36 namespace content { | 36 namespace content { |
| 37 | 37 |
| 38 const int32 RenderViewFakeResourcesTest::kViewId = 5; | 38 const int32 RenderViewFakeResourcesTest::kViewId = 5; |
| 39 | 39 |
| 40 RenderViewFakeResourcesTest::RenderViewFakeResourcesTest() {} | 40 RenderViewFakeResourcesTest::RenderViewFakeResourcesTest() {} |
| 41 RenderViewFakeResourcesTest::~RenderViewFakeResourcesTest() {} | 41 RenderViewFakeResourcesTest::~RenderViewFakeResourcesTest() {} |
| 42 | 42 |
| 43 bool RenderViewFakeResourcesTest::OnMessageReceived( | 43 bool RenderViewFakeResourcesTest::OnMessageReceived( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting(false); | 80 RendererWebKitPlatformSupportImpl::SetSandboxEnabledForTesting(false); |
| 81 render_thread_ = new RenderThreadImpl(channel_id); | 81 render_thread_ = new RenderThreadImpl(channel_id); |
| 82 | 82 |
| 83 // Tell the renderer to create a view, then wait until it's ready. | 83 // Tell the renderer to create a view, then wait until it's ready. |
| 84 // We can't call View::Create() directly here or else we won't get | 84 // We can't call View::Create() directly here or else we won't get |
| 85 // RenderProcess's lazy initialization of WebKit. | 85 // RenderProcess's lazy initialization of WebKit. |
| 86 view_ = NULL; | 86 view_ = NULL; |
| 87 ViewMsg_New_Params params; | 87 ViewMsg_New_Params params; |
| 88 params.view_id = kViewId; | 88 params.view_id = kViewId; |
| 89 params.opener_route_id = MSG_ROUTING_NONE; | 89 params.opener_route_id = MSG_ROUTING_NONE; |
| 90 params.session_storage_namespace_id = | 90 params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId; |
| 91 dom_storage::kInvalidSessionStorageNamespaceId; | |
| 92 ASSERT_TRUE(channel_->Send(new ViewMsg_New(params))); | 91 ASSERT_TRUE(channel_->Send(new ViewMsg_New(params))); |
| 93 message_loop_.Run(); | 92 message_loop_.Run(); |
| 94 } | 93 } |
| 95 | 94 |
| 96 void RenderViewFakeResourcesTest::TearDown() { | 95 void RenderViewFakeResourcesTest::TearDown() { |
| 97 // Try very hard to collect garbage before shutting down. | 96 // Try very hard to collect garbage before shutting down. |
| 98 GetMainFrame()->collectGarbage(); | 97 GetMainFrame()->collectGarbage(); |
| 99 GetMainFrame()->collectGarbage(); | 98 GetMainFrame()->collectGarbage(); |
| 100 | 99 |
| 101 ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId))); | 100 ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId))); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 params.url = GURL(history_item.urlString()); | 218 params.url = GURL(history_item.urlString()); |
| 220 params.transition = PAGE_TRANSITION_FORWARD_BACK; | 219 params.transition = PAGE_TRANSITION_FORWARD_BACK; |
| 221 params.page_state = HistoryItemToPageState(history_item); | 220 params.page_state = HistoryItemToPageState(history_item); |
| 222 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 221 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
| 223 params.request_time = base::Time::Now(); | 222 params.request_time = base::Time::Now(); |
| 224 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); | 223 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); |
| 225 message_loop_.Run(); | 224 message_loop_.Run(); |
| 226 } | 225 } |
| 227 | 226 |
| 228 } // namespace content | 227 } // namespace content |
| OLD | NEW |