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/process.h" | 9 #include "base/process.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 return false; | 53 return false; |
54 } | 54 } |
55 | 55 |
56 void RenderViewFakeResourcesTest::SetUp() { | 56 void RenderViewFakeResourcesTest::SetUp() { |
57 // Set up the renderer. This code is largely adapted from | 57 // Set up the renderer. This code is largely adapted from |
58 // render_view_test.cc and renderer_main.cc. Note that we use a | 58 // render_view_test.cc and renderer_main.cc. Note that we use a |
59 // MockRenderProcess (because we don't need to use IPC for painting), | 59 // MockRenderProcess (because we don't need to use IPC for painting), |
60 // but we use a real RenderThread so that we can use the ResourceDispatcher | 60 // but we use a real RenderThread so that we can use the ResourceDispatcher |
61 // to fetch network resources. These are then served canned content | 61 // to fetch network resources. These are then served canned content |
62 // in OnRequestResource(). | 62 // in OnRequestResource(). |
63 GetContentClient()->set_renderer_for_testing(&content_renderer_client_); | 63 SetRendererClientForTesting(&content_renderer_client_); |
64 // Generate a unique channel id so that multiple instances of the test can | 64 // Generate a unique channel id so that multiple instances of the test can |
65 // run in parallel. | 65 // run in parallel. |
66 std::string channel_id = IPC::Channel::GenerateVerifiedChannelID( | 66 std::string channel_id = IPC::Channel::GenerateVerifiedChannelID( |
67 std::string()); | 67 std::string()); |
68 channel_.reset(new IPC::Channel(channel_id, | 68 channel_.reset(new IPC::Channel(channel_id, |
69 IPC::Channel::MODE_SERVER, this)); | 69 IPC::Channel::MODE_SERVER, this)); |
70 ASSERT_TRUE(channel_->Connect()); | 70 ASSERT_TRUE(channel_->Connect()); |
71 | 71 |
72 webkit_glue::SetJavaScriptFlags("--expose-gc"); | 72 webkit_glue::SetJavaScriptFlags("--expose-gc"); |
73 mock_process_.reset(new MockRenderProcess); | 73 mock_process_.reset(new MockRenderProcess); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 params.url = GURL(history_item.urlString()); | 214 params.url = GURL(history_item.urlString()); |
215 params.transition = PAGE_TRANSITION_FORWARD_BACK; | 215 params.transition = PAGE_TRANSITION_FORWARD_BACK; |
216 params.state = webkit_glue::HistoryItemToString(history_item); | 216 params.state = webkit_glue::HistoryItemToString(history_item); |
217 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; | 217 params.navigation_type = ViewMsg_Navigate_Type::NORMAL; |
218 params.request_time = base::Time::Now(); | 218 params.request_time = base::Time::Now(); |
219 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); | 219 channel_->Send(new ViewMsg_Navigate(impl->routing_id(), params)); |
220 message_loop_.Run(); | 220 message_loop_.Run(); |
221 } | 221 } |
222 | 222 |
223 } // namespace content | 223 } // namespace content |
OLD | NEW |