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"); | |
147 thread_ = new RenderThreadImplForTest(test_helper_->GetChannelId(), | 141 thread_ = new RenderThreadImplForTest(test_helper_->GetChannelId(), |
148 test_task_counter_); | 142 test_task_counter_); |
149 cmd->InitFromArgv(old_argv); | |
150 | |
151 thread_->EnsureWebKitInitialized(); | 143 thread_->EnsureWebKitInitialized(); |
152 | 144 |
153 test_msg_filter_ = make_scoped_refptr( | 145 test_msg_filter_ = make_scoped_refptr( |
154 new QuitOnTestMsgFilter(test_helper_->GetMessageLoop())); | 146 new QuitOnTestMsgFilter(test_helper_->GetMessageLoop())); |
155 thread_->AddFilter(test_msg_filter_.get()); | 147 thread_->AddFilter(test_msg_filter_.get()); |
156 } | 148 } |
157 | 149 |
158 scoped_refptr<TestTaskCounter> test_task_counter_; | 150 scoped_refptr<TestTaskCounter> test_task_counter_; |
159 scoped_ptr<ContentClient> content_client_; | 151 scoped_ptr<ContentClient> content_client_; |
160 scoped_ptr<ContentBrowserClient> content_browser_client_; | 152 scoped_ptr<ContentBrowserClient> content_browser_client_; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); | 223 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); |
232 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); | 224 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); |
233 | 225 |
234 test_helper_->GetMessageLoop()->Run(); | 226 test_helper_->GetMessageLoop()->Run(); |
235 | 227 |
236 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); | 228 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); |
237 } | 229 } |
238 | 230 |
239 } // namespace | 231 } // namespace |
240 } // namespace content | 232 } // namespace content |
OLD | NEW |