| 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/strings/string_number_conversions.h" |
| 10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| 11 #include "content/common/resource_messages.h" | 11 #include "content/common/resource_messages.h" |
| 12 #include "content/common/websocket_messages.h" | 12 #include "content/common/websocket_messages.h" |
| 13 #include "content/public/browser/content_browser_client.h" | 13 #include "content/public/browser/content_browser_client.h" |
| 14 #include "content/public/common/content_client.h" | 14 #include "content/public/common/content_client.h" |
| 15 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
| 16 #include "content/public/renderer/content_renderer_client.h" | 16 #include "content/public/renderer/content_renderer_client.h" |
| 17 #include "content/renderer/render_process_impl.h" | 17 #include "content/renderer/render_process_impl.h" |
| 18 #include "content/renderer/render_thread_impl.h" | 18 #include "content/renderer/render_thread_impl.h" |
| 19 #include "content/renderer/scheduler/renderer_scheduler.h" |
| 19 #include "content/test/mock_render_process.h" | 20 #include "content/test/mock_render_process.h" |
| 20 #include "content/test/render_thread_impl_browser_test_ipc_helper.h" | 21 #include "content/test/render_thread_impl_browser_test_ipc_helper.h" |
| 21 #include "gpu/GLES2/gl2extchromium.h" | 22 #include "gpu/GLES2/gl2extchromium.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 24 |
| 24 // IPC messages for testing ---------------------------------------------------- | 25 // IPC messages for testing ---------------------------------------------------- |
| 25 | 26 |
| 26 #define IPC_MESSAGE_IMPL | 27 #define IPC_MESSAGE_IMPL |
| 27 #include "ipc/ipc_message_macros.h" | 28 #include "ipc/ipc_message_macros.h" |
| 28 | 29 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 #if defined(COMPILER_MSVC) | 83 #if defined(COMPILER_MSVC) |
| 83 // See explanation for other RenderViewHostImpl which is the same issue. | 84 // See explanation for other RenderViewHostImpl which is the same issue. |
| 84 #pragma warning(push) | 85 #pragma warning(push) |
| 85 #pragma warning(disable: 4250) | 86 #pragma warning(disable: 4250) |
| 86 #endif | 87 #endif |
| 87 | 88 |
| 88 class RenderThreadImplForTest : public RenderThreadImpl { | 89 class RenderThreadImplForTest : public RenderThreadImpl { |
| 89 public: | 90 public: |
| 90 RenderThreadImplForTest(const std::string& channel_id, | 91 RenderThreadImplForTest(const std::string& channel_id, |
| 91 scoped_refptr<TestTaskCounter> test_task_counter) | 92 scoped_refptr<TestTaskCounter> test_task_counter) |
| 92 : RenderThreadImpl(channel_id), test_task_counter_(test_task_counter) {} | 93 : RenderThreadImpl(channel_id, RendererScheduler::Create()), |
| 94 test_task_counter_(test_task_counter) {} |
| 93 | 95 |
| 94 ~RenderThreadImplForTest() override {} | 96 ~RenderThreadImplForTest() override {} |
| 95 | 97 |
| 96 void SetResourceDispatchTaskQueue( | 98 void SetResourceDispatchTaskQueue( |
| 97 const scoped_refptr<base::SingleThreadTaskRunner>&) override { | 99 const scoped_refptr<base::SingleThreadTaskRunner>&) override { |
| 98 // Use our TestTaskCounter instead. | 100 // Use our TestTaskCounter instead. |
| 99 RenderThreadImpl::SetResourceDispatchTaskQueue(test_task_counter_); | 101 RenderThreadImpl::SetResourceDispatchTaskQueue(test_task_counter_); |
| 100 } | 102 } |
| 101 | 103 |
| 102 using ChildThreadImpl::OnMessageReceived; | 104 using ChildThreadImpl::OnMessageReceived; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); | 248 test_helper_->Sender()->Send(new WebSocketMsg_NotifyFailure(1, "")); |
| 247 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); | 249 test_helper_->Sender()->Send(new TestMsg_QuitRunLoop()); |
| 248 | 250 |
| 249 test_helper_->GetMessageLoop()->Run(); | 251 test_helper_->GetMessageLoop()->Run(); |
| 250 | 252 |
| 251 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); | 253 EXPECT_EQ(0, test_task_counter_->NumTasksPosted()); |
| 252 } | 254 } |
| 253 | 255 |
| 254 } // namespace | 256 } // namespace |
| 255 } // namespace content | 257 } // namespace content |
| OLD | NEW |