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/test/render_view_fake_resources_test.h" | 5 #include "content/test/render_view_fake_resources_test.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "base/shared_memory.h" | 10 #include "base/shared_memory.h" |
11 #include "base/time.h" | 11 #include "base/time.h" |
12 #include "content/common/dom_storage_common.h" | |
13 #include "content/common/resource_messages.h" | 12 #include "content/common/resource_messages.h" |
14 #include "content/common/view_messages.h" | 13 #include "content/common/view_messages.h" |
15 #include "content/public/common/resource_response.h" | 14 #include "content/public/common/resource_response.h" |
16 #include "content/renderer/render_thread_impl.h" | 15 #include "content/renderer/render_thread_impl.h" |
17 #include "content/renderer/render_view_impl.h" | 16 #include "content/renderer/render_view_impl.h" |
18 #include "content/test/mock_render_process.h" | 17 #include "content/test/mock_render_process.h" |
19 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
20 #include "net/base/upload_data.h" | 19 #include "net/base/upload_data.h" |
21 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
22 #include "net/url_request/url_request_status.h" | 21 #include "net/url_request/url_request_status.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 27 #include "webkit/dom_storage/dom_storage_types.h" |
28 #include "webkit/glue/glue_serialize.h" | 28 #include "webkit/glue/glue_serialize.h" |
29 #include "webkit/glue/webkit_glue.h" | 29 #include "webkit/glue/webkit_glue.h" |
30 | 30 |
31 const int32 RenderViewFakeResourcesTest::kViewId = 5; | 31 const int32 RenderViewFakeResourcesTest::kViewId = 5; |
32 | 32 |
33 RenderViewFakeResourcesTest::RenderViewFakeResourcesTest() {} | 33 RenderViewFakeResourcesTest::RenderViewFakeResourcesTest() {} |
34 RenderViewFakeResourcesTest::~RenderViewFakeResourcesTest() {} | 34 RenderViewFakeResourcesTest::~RenderViewFakeResourcesTest() {} |
35 | 35 |
36 bool RenderViewFakeResourcesTest::OnMessageReceived( | 36 bool RenderViewFakeResourcesTest::OnMessageReceived( |
37 const IPC::Message& message) { | 37 const IPC::Message& message) { |
(...skipping 27 matching lines...) Expand all Loading... |
65 mock_process_.reset(new MockRenderProcess); | 65 mock_process_.reset(new MockRenderProcess); |
66 render_thread_ = new RenderThreadImpl(kThreadName); | 66 render_thread_ = new RenderThreadImpl(kThreadName); |
67 | 67 |
68 // Tell the renderer to create a view, then wait until it's ready. | 68 // Tell the renderer to create a view, then wait until it's ready. |
69 // We can't call View::Create() directly here or else we won't get | 69 // We can't call View::Create() directly here or else we won't get |
70 // RenderProcess's lazy initialization of WebKit. | 70 // RenderProcess's lazy initialization of WebKit. |
71 view_ = NULL; | 71 view_ = NULL; |
72 ViewMsg_New_Params params; | 72 ViewMsg_New_Params params; |
73 params.parent_window = 0; | 73 params.parent_window = 0; |
74 params.view_id = kViewId; | 74 params.view_id = kViewId; |
75 params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId; | 75 params.session_storage_namespace_id = |
| 76 dom_storage::kInvalidSessionStorageNamespaceId; |
76 ASSERT_TRUE(channel_->Send(new ViewMsg_New(params))); | 77 ASSERT_TRUE(channel_->Send(new ViewMsg_New(params))); |
77 message_loop_.Run(); | 78 message_loop_.Run(); |
78 } | 79 } |
79 | 80 |
80 void RenderViewFakeResourcesTest::TearDown() { | 81 void RenderViewFakeResourcesTest::TearDown() { |
81 // Try very hard to collect garbage before shutting down. | 82 // Try very hard to collect garbage before shutting down. |
82 GetMainFrame()->collectGarbage(); | 83 GetMainFrame()->collectGarbage(); |
83 GetMainFrame()->collectGarbage(); | 84 GetMainFrame()->collectGarbage(); |
84 | 85 |
85 ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId))); | 86 ASSERT_TRUE(channel_->Send(new ViewMsg_Close(kViewId))); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 params.current_history_list_length = (impl->historyBackListCount() + | 191 params.current_history_list_length = (impl->historyBackListCount() + |
191 impl->historyForwardListCount() + 1); | 192 impl->historyForwardListCount() + 1); |
192 params.url = GURL(history_item.urlString()); | 193 params.url = GURL(history_item.urlString()); |
193 params.transition = content::PAGE_TRANSITION_FORWARD_BACK; | 194 params.transition = content::PAGE_TRANSITION_FORWARD_BACK; |
194 params.state = webkit_glue::HistoryItemToString(history_item); | 195 params.state = webkit_glue::HistoryItemToString(history_item); |
195 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 196 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
196 params.request_time = base::Time::Now(); | 197 params.request_time = base::Time::Now(); |
197 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); | 198 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); |
198 message_loop_.Run(); | 199 message_loop_.Run(); |
199 } | 200 } |
OLD | NEW |