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/strings/string_number_conversions.h" |
9 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
10 #include "content/common/resource_messages.h" | 11 #include "content/common/resource_messages.h" |
11 #include "content/common/websocket_messages.h" | 12 #include "content/common/websocket_messages.h" |
12 #include "content/public/browser/content_browser_client.h" | 13 #include "content/public/browser/content_browser_client.h" |
13 #include "content/public/common/content_client.h" | 14 #include "content/public/common/content_client.h" |
14 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
15 #include "content/public/renderer/content_renderer_client.h" | 16 #include "content/public/renderer/content_renderer_client.h" |
16 #include "content/renderer/render_process_impl.h" | 17 #include "content/renderer/render_process_impl.h" |
17 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
18 #include "content/test/mock_render_process.h" | 19 #include "content/test/mock_render_process.h" |
19 #include "content/test/render_thread_impl_browser_test_ipc_helper.h" | 20 #include "content/test/render_thread_impl_browser_test_ipc_helper.h" |
| 21 #include "gpu/GLES2/gl2extchromium.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
21 | 23 |
22 // IPC messages for testing ---------------------------------------------------- | 24 // IPC messages for testing ---------------------------------------------------- |
23 | 25 |
24 #define IPC_MESSAGE_IMPL | 26 #define IPC_MESSAGE_IMPL |
25 #include "ipc/ipc_message_macros.h" | 27 #include "ipc/ipc_message_macros.h" |
26 | 28 |
27 #undef IPC_MESSAGE_START | 29 #undef IPC_MESSAGE_START |
28 #define IPC_MESSAGE_START TestMsgStart | 30 #define IPC_MESSAGE_START TestMsgStart |
29 IPC_MESSAGE_CONTROL0(TestMsg_QuitRunLoop) | 31 IPC_MESSAGE_CONTROL0(TestMsg_QuitRunLoop) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 test_helper_.reset(new RenderThreadImplBrowserIPCTestHelper()); | 149 test_helper_.reset(new RenderThreadImplBrowserIPCTestHelper()); |
148 | 150 |
149 mock_process_.reset(new MockRenderProcess); | 151 mock_process_.reset(new MockRenderProcess); |
150 test_task_counter_ = make_scoped_refptr(new TestTaskCounter()); | 152 test_task_counter_ = make_scoped_refptr(new TestTaskCounter()); |
151 | 153 |
152 // RenderThreadImpl expects the browser to pass these flags. | 154 // RenderThreadImpl expects the browser to pass these flags. |
153 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); | 155 base::CommandLine* cmd = base::CommandLine::ForCurrentProcess(); |
154 base::CommandLine::StringVector old_argv = cmd->argv(); | 156 base::CommandLine::StringVector old_argv = cmd->argv(); |
155 | 157 |
156 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1"); | 158 cmd->AppendSwitchASCII(switches::kNumRasterThreads, "1"); |
| 159 cmd->AppendSwitchASCII(switches::kUseImageTextureTarget, |
| 160 base::UintToString(GL_TEXTURE_2D)); |
| 161 |
157 thread_ = new RenderThreadImplForTest(test_helper_->GetChannelId(), | 162 thread_ = new RenderThreadImplForTest(test_helper_->GetChannelId(), |
158 test_task_counter_); | 163 test_task_counter_); |
159 cmd->InitFromArgv(old_argv); | 164 cmd->InitFromArgv(old_argv); |
160 | 165 |
161 thread_->EnsureWebKitInitialized(); | 166 thread_->EnsureWebKitInitialized(); |
162 | 167 |
163 test_msg_filter_ = make_scoped_refptr( | 168 test_msg_filter_ = make_scoped_refptr( |
164 new QuitOnTestMsgFilter(test_helper_->GetMessageLoop())); | 169 new QuitOnTestMsgFilter(test_helper_->GetMessageLoop())); |
165 thread_->AddFilter(test_msg_filter_.get()); | 170 thread_->AddFilter(test_msg_filter_.get()); |
166 } | 171 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); | 246 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); |
242 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); | 247 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); |
243 | 248 |
244 test_helper_->GetMessageLoop()->Run(); | 249 test_helper_->GetMessageLoop()->Run(); |
245 | 250 |
246 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); | 251 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); |
247 } | 252 } |
248 | 253 |
249 } // namespace | 254 } // namespace |
250 } // namespace content | 255 } // namespace content |
OLD | NEW |