| 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 "chrome/renderer/safe_browsing/render_view_fake_resources_test.h" | 5 #include "chrome/renderer/safe_browsing/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 "chrome/common/render_messages.h" | |
| 13 #include "content/common/dom_storage_common.h" | 12 #include "content/common/dom_storage_common.h" |
| 14 #include "content/common/resource_messages.h" | 13 #include "content/common/resource_messages.h" |
| 15 #include "content/common/resource_response.h" | 14 #include "content/common/resource_response.h" |
| 16 #include "content/common/view_messages.h" | 15 #include "content/common/view_messages.h" |
| 17 #include "content/renderer/mock_render_process.h" | 16 #include "content/renderer/mock_render_process.h" |
| 18 #include "content/renderer/render_thread.h" | 17 #include "content/renderer/render_thread_impl.h" |
| 19 #include "content/renderer/render_view.h" | 18 #include "content/renderer/render_view.h" |
| 20 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 21 #include "net/base/upload_data.h" | 20 #include "net/base/upload_data.h" |
| 22 #include "net/http/http_response_headers.h" | 21 #include "net/http/http_response_headers.h" |
| 23 #include "net/url_request/url_request_status.h" | 22 #include "net/url_request/url_request_status.h" |
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" |
| 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 26 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 27 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // to fetch network resources. These are then served canned content | 62 // to fetch network resources. These are then served canned content |
| 64 // in OnRequestResource(). | 63 // in OnRequestResource(). |
| 65 content::GetContentClient()->set_renderer(&chrome_content_renderer_client_); | 64 content::GetContentClient()->set_renderer(&chrome_content_renderer_client_); |
| 66 static const char kThreadName[] = "RenderViewFakeResourcesTest"; | 65 static const char kThreadName[] = "RenderViewFakeResourcesTest"; |
| 67 channel_.reset(new IPC::Channel(kThreadName, | 66 channel_.reset(new IPC::Channel(kThreadName, |
| 68 IPC::Channel::MODE_SERVER, this)); | 67 IPC::Channel::MODE_SERVER, this)); |
| 69 ASSERT_TRUE(channel_->Connect()); | 68 ASSERT_TRUE(channel_->Connect()); |
| 70 | 69 |
| 71 webkit_glue::SetJavaScriptFlags("--expose-gc"); | 70 webkit_glue::SetJavaScriptFlags("--expose-gc"); |
| 72 mock_process_.reset(new MockRenderProcess); | 71 mock_process_.reset(new MockRenderProcess); |
| 73 render_thread_ = new RenderThread(kThreadName); | 72 render_thread_ = new RenderThreadImpl(kThreadName); |
| 74 mock_process_->set_main_thread(render_thread_); | 73 mock_process_->set_main_thread(render_thread_); |
| 75 #if defined(OS_MACOSX) | 74 #if defined(OS_MACOSX) |
| 76 InitWebCoreSystemInterface(); | 75 InitWebCoreSystemInterface(); |
| 77 #endif | 76 #endif |
| 78 | 77 |
| 79 // Tell the renderer to create a view, then wait until it's ready. | 78 // Tell the renderer to create a view, then wait until it's ready. |
| 80 // We can't call View::Create() directly here or else we won't get | 79 // We can't call View::Create() directly here or else we won't get |
| 81 // RenderProcess's lazy initialization of WebKit. | 80 // RenderProcess's lazy initialization of WebKit. |
| 82 view_ = NULL; | 81 view_ = NULL; |
| 83 ViewMsg_New_Params params; | 82 ViewMsg_New_Params params; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 params.url = GURL(history_item.urlString()); | 197 params.url = GURL(history_item.urlString()); |
| 199 params.transition = PageTransition::FORWARD_BACK; | 198 params.transition = PageTransition::FORWARD_BACK; |
| 200 params.state = webkit_glue::HistoryItemToString(history_item); | 199 params.state = webkit_glue::HistoryItemToString(history_item); |
| 201 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 200 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
| 202 params.request_time = base::Time::Now(); | 201 params.request_time = base::Time::Now(); |
| 203 channel_->Send(new ViewMsg_Navigate(view_->routing_id(), params)); | 202 channel_->Send(new ViewMsg_Navigate(view_->routing_id(), params)); |
| 204 message_loop_.Run(); | 203 message_loop_.Run(); |
| 205 } | 204 } |
| 206 | 205 |
| 207 } // namespace safe_browsing | 206 } // namespace safe_browsing |
| OLD | NEW |