| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/process.h" | 10 #include "base/process.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 | 52 |
| 53 void RenderViewFakeResourcesTest::SetUp() { | 53 void RenderViewFakeResourcesTest::SetUp() { |
| 54 // Set up the renderer. This code is largely adapted from | 54 // Set up the renderer. This code is largely adapted from |
| 55 // render_view_test.cc and renderer_main.cc. Note that we use a | 55 // render_view_test.cc and renderer_main.cc. Note that we use a |
| 56 // MockRenderProcess (because we don't need to use IPC for painting), | 56 // MockRenderProcess (because we don't need to use IPC for painting), |
| 57 // but we use a real RenderThread so that we can use the ResourceDispatcher | 57 // but we use a real RenderThread so that we can use the ResourceDispatcher |
| 58 // to fetch network resources. These are then served canned content | 58 // to fetch network resources. These are then served canned content |
| 59 // in OnRequestResource(). | 59 // in OnRequestResource(). |
| 60 sandbox_init_wrapper_.reset(new SandboxInitWrapper); | 60 sandbox_init_wrapper_.reset(new SandboxInitWrapper); |
| 61 command_line_.reset(new CommandLine(CommandLine::ARGUMENTS_ONLY)); | 61 command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM)); |
| 62 params_.reset(new MainFunctionParams(*command_line_, | 62 params_.reset(new MainFunctionParams(*command_line_, |
| 63 *sandbox_init_wrapper_, NULL)); | 63 *sandbox_init_wrapper_, NULL)); |
| 64 platform_.reset(new RendererMainPlatformDelegate(*params_)); | 64 platform_.reset(new RendererMainPlatformDelegate(*params_)); |
| 65 platform_->PlatformInitialize(); | 65 platform_->PlatformInitialize(); |
| 66 | 66 |
| 67 static const char kThreadName[] = "RenderViewFakeResourcesTest"; | 67 static const char kThreadName[] = "RenderViewFakeResourcesTest"; |
| 68 channel_.reset(new IPC::Channel(kThreadName, | 68 channel_.reset(new IPC::Channel(kThreadName, |
| 69 IPC::Channel::MODE_SERVER, this)); | 69 IPC::Channel::MODE_SERVER, this)); |
| 70 ASSERT_TRUE(channel_->Connect()); | 70 ASSERT_TRUE(channel_->Connect()); |
| 71 | 71 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 170 |
| 171 void RenderViewFakeResourcesTest::OnRenderViewReady() { | 171 void RenderViewFakeResourcesTest::OnRenderViewReady() { |
| 172 // Grab a pointer to the new view using RenderViewVisitor. | 172 // Grab a pointer to the new view using RenderViewVisitor. |
| 173 ASSERT_TRUE(!view_); | 173 ASSERT_TRUE(!view_); |
| 174 RenderView::ForEach(this); | 174 RenderView::ForEach(this); |
| 175 ASSERT_TRUE(view_); | 175 ASSERT_TRUE(view_); |
| 176 message_loop_.Quit(); | 176 message_loop_.Quit(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 } // namespace safe_browsing | 179 } // namespace safe_browsing |
| OLD | NEW |