OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/memory/discardable_memory.h" | 7 #include "base/memory/discardable_memory.h" |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "content/common/resource_messages.h" | 10 #include "content/common/resource_messages.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 content_browser_client_.reset(new ContentBrowserClient()); | 131 content_browser_client_.reset(new ContentBrowserClient()); |
132 content_renderer_client_.reset(new ContentRendererClient()); | 132 content_renderer_client_.reset(new ContentRendererClient()); |
133 SetContentClient(content_client_.get()); | 133 SetContentClient(content_client_.get()); |
134 SetBrowserClientForTesting(content_browser_client_.get()); | 134 SetBrowserClientForTesting(content_browser_client_.get()); |
135 SetRendererClientForTesting(content_renderer_client_.get()); | 135 SetRendererClientForTesting(content_renderer_client_.get()); |
136 | 136 |
137 test_helper_.reset(new RenderThreadImplBrowserIPCTestHelper()); | 137 test_helper_.reset(new RenderThreadImplBrowserIPCTestHelper()); |
138 | 138 |
139 mock_process_.reset(new MockRenderProcess); | 139 mock_process_.reset(new MockRenderProcess); |
140 test_task_counter_ = make_scoped_refptr(new TestTaskCounter()); | 140 test_task_counter_ = make_scoped_refptr(new TestTaskCounter()); |
| 141 |
| 142 // RenderThreadImpl expects the browser to pass these flags. |
| 143 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
| 144 base::CommandLine::StringVector old_argv = cmd->argv(); |
| 145 |
| 146 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1"); |
141 thread_ = new RenderThreadImplForTest(test_helper_->GetChannelId(), | 147 thread_ = new RenderThreadImplForTest(test_helper_->GetChannelId(), |
142 test_task_counter_); | 148 test_task_counter_); |
| 149 cmd->InitFromArgv(old_argv); |
| 150 |
143 thread_->EnsureWebKitInitialized(); | 151 thread_->EnsureWebKitInitialized(); |
144 | 152 |
145 test_msg_filter_ = make_scoped_refptr( | 153 test_msg_filter_ = make_scoped_refptr( |
146 new QuitOnTestMsgFilter(test_helper_->GetMessageLoop())); | 154 new QuitOnTestMsgFilter(test_helper_->GetMessageLoop())); |
147 thread_->AddFilter(test_msg_filter_.get()); | 155 thread_->AddFilter(test_msg_filter_.get()); |
148 } | 156 } |
149 | 157 |
150 scoped_refptr<TestTaskCounter> test_task_counter_; | 158 scoped_refptr<TestTaskCounter> test_task_counter_; |
151 scoped_ptr<ContentClient> content_client_; | 159 scoped_ptr<ContentClient> content_client_; |
152 scoped_ptr<ContentBrowserClient> content_browser_client_; | 160 scoped_ptr<ContentBrowserClient> content_browser_client_; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); | 231 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); |
224 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); | 232 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); |
225 | 233 |
226 test_helper_->GetMessageLoop()->Run(); | 234 test_helper_->GetMessageLoop()->Run(); |
227 | 235 |
228 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); | 236 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); |
229 } | 237 } |
230 | 238 |
231 } // namespace | 239 } // namespace |
232 } // namespace content | 240 } // namespace content |
OLD | NEW |