| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "net/http/http_response_headers.h" | 21 #include "net/http/http_response_headers.h" |
| 22 #include "net/url_request/url_request_status.h" | 22 #include "net/url_request/url_request_status.h" |
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.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 #if defined(OS_MACOSX) | |
| 32 #include "third_party/WebKit/Source/WebKit/mac/WebCoreSupport/WebSystemInterface
.h" | |
| 33 #endif | |
| 34 | |
| 35 const int32 RenderViewFakeResourcesTest::kViewId = 5; | 31 const int32 RenderViewFakeResourcesTest::kViewId = 5; |
| 36 | 32 |
| 37 RenderViewFakeResourcesTest::RenderViewFakeResourcesTest() {} | 33 RenderViewFakeResourcesTest::RenderViewFakeResourcesTest() {} |
| 38 RenderViewFakeResourcesTest::~RenderViewFakeResourcesTest() {} | 34 RenderViewFakeResourcesTest::~RenderViewFakeResourcesTest() {} |
| 39 | 35 |
| 40 bool RenderViewFakeResourcesTest::OnMessageReceived( | 36 bool RenderViewFakeResourcesTest::OnMessageReceived( |
| 41 const IPC::Message& message) { | 37 const IPC::Message& message) { |
| 42 IPC_BEGIN_MESSAGE_MAP(RenderViewFakeResourcesTest, message) | 38 IPC_BEGIN_MESSAGE_MAP(RenderViewFakeResourcesTest, message) |
| 43 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) | 39 IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnRenderViewReady) |
| 44 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnDidStopLoading) | 40 IPC_MESSAGE_HANDLER(ViewHostMsg_DidStopLoading, OnDidStopLoading) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 61 // in OnRequestResource(). | 57 // in OnRequestResource(). |
| 62 content::GetContentClient()->set_renderer(&content_renderer_client_); | 58 content::GetContentClient()->set_renderer(&content_renderer_client_); |
| 63 static const char kThreadName[] = "RenderViewFakeResourcesTest"; | 59 static const char kThreadName[] = "RenderViewFakeResourcesTest"; |
| 64 channel_.reset(new IPC::Channel(kThreadName, | 60 channel_.reset(new IPC::Channel(kThreadName, |
| 65 IPC::Channel::MODE_SERVER, this)); | 61 IPC::Channel::MODE_SERVER, this)); |
| 66 ASSERT_TRUE(channel_->Connect()); | 62 ASSERT_TRUE(channel_->Connect()); |
| 67 | 63 |
| 68 webkit_glue::SetJavaScriptFlags("--expose-gc"); | 64 webkit_glue::SetJavaScriptFlags("--expose-gc"); |
| 69 mock_process_.reset(new MockRenderProcess); | 65 mock_process_.reset(new MockRenderProcess); |
| 70 render_thread_ = new RenderThreadImpl(kThreadName); | 66 render_thread_ = new RenderThreadImpl(kThreadName); |
| 71 #if defined(OS_MACOSX) | |
| 72 InitWebCoreSystemInterface(); | |
| 73 #endif | |
| 74 | 67 |
| 75 // 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. |
| 76 // 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 |
| 77 // RenderProcess's lazy initialization of WebKit. | 70 // RenderProcess's lazy initialization of WebKit. |
| 78 view_ = NULL; | 71 view_ = NULL; |
| 79 ViewMsg_New_Params params; | 72 ViewMsg_New_Params params; |
| 80 params.parent_window = 0; | 73 params.parent_window = 0; |
| 81 params.view_id = kViewId; | 74 params.view_id = kViewId; |
| 82 params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId; | 75 params.session_storage_namespace_id = kInvalidSessionStorageNamespaceId; |
| 83 ASSERT_TRUE(channel_->Send(new ViewMsg_New(params))); | 76 ASSERT_TRUE(channel_->Send(new ViewMsg_New(params))); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 params.current_history_list_length = (impl->historyBackListCount() + | 190 params.current_history_list_length = (impl->historyBackListCount() + |
| 198 impl->historyForwardListCount() + 1); | 191 impl->historyForwardListCount() + 1); |
| 199 params.url = GURL(history_item.urlString()); | 192 params.url = GURL(history_item.urlString()); |
| 200 params.transition = content::PAGE_TRANSITION_FORWARD_BACK; | 193 params.transition = content::PAGE_TRANSITION_FORWARD_BACK; |
| 201 params.state = webkit_glue::HistoryItemToString(history_item); | 194 params.state = webkit_glue::HistoryItemToString(history_item); |
| 202 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 195 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
| 203 params.request_time = base::Time::Now(); | 196 params.request_time = base::Time::Now(); |
| 204 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); | 197 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); |
| 205 message_loop_.Run(); | 198 message_loop_.Run(); |
| 206 } | 199 } |
| OLD | NEW |