OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/public/browser/content_browser_client.h" | 5 #include "content/public/browser/content_browser_client.h" |
6 #include "content/public/common/content_client.h" | 6 #include "content/public/common/content_client.h" |
7 #include "content/public/renderer/content_renderer_client.h" | 7 #include "content/public/renderer/content_renderer_client.h" |
8 #include "content/renderer/render_process_impl.h" | 8 #include "content/renderer/render_process_impl.h" |
9 #include "content/renderer/render_thread_impl.h" | 9 #include "content/renderer/render_thread_impl.h" |
10 #include "content/renderer/scheduler_proxy_task_runner.h" | 10 #include "content/renderer/scheduler_proxy_task_runner.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 DummyListener dummy_listener; | 41 DummyListener dummy_listener; |
42 scoped_ptr<IPC::Channel> channel( | 42 scoped_ptr<IPC::Channel> channel( |
43 IPC::Channel::CreateServer(channel_id, &dummy_listener)); | 43 IPC::Channel::CreateServer(channel_id, &dummy_listener)); |
44 EXPECT_TRUE(channel->Connect()); | 44 EXPECT_TRUE(channel->Connect()); |
45 | 45 |
46 scoped_ptr<MockRenderProcess> mock_process(new MockRenderProcess); | 46 scoped_ptr<MockRenderProcess> mock_process(new MockRenderProcess); |
47 // Owned by mock_process. | 47 // Owned by mock_process. |
48 RenderThreadImpl* thread = new RenderThreadImpl(channel_id); | 48 RenderThreadImpl* thread = new RenderThreadImpl(channel_id); |
49 thread->EnsureWebKitInitialized(); | 49 thread->EnsureWebKitInitialized(); |
50 | 50 |
51 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner = | |
52 make_scoped_refptr(new SchedulerProxyTaskRunner< | |
53 &blink::WebSchedulerProxy::postInputTask>()); | |
54 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = | 51 scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner = |
55 make_scoped_refptr(new SchedulerProxyTaskRunner< | 52 thread->main_thread_compositor_task_runner(); |
56 &blink::WebSchedulerProxy::postCompositorTask>()); | |
57 | 53 |
58 int input_order = 0; | 54 EXPECT_TRUE(compositor_task_runner->BelongsToCurrentThread()); |
| 55 |
59 int compositor_order = 0; | 56 int compositor_order = 0; |
60 | |
61 input_task_runner->PostTask(FROM_HERE, | |
62 base::Bind(&TestTask, 1, &input_order)); | |
63 compositor_task_runner->PostTask(FROM_HERE, | 57 compositor_task_runner->PostTask(FROM_HERE, |
64 base::Bind(&TestTask, 1, &compositor_order)); | 58 base::Bind(&TestTask, 1, &compositor_order)); |
65 input_task_runner->PostTask(FROM_HERE, | |
66 base::Bind(&TestTask, 2, &input_order)); | |
67 compositor_task_runner->PostTask(FROM_HERE, | 59 compositor_task_runner->PostTask(FROM_HERE, |
68 base::Bind(&TestTask, 2, &compositor_order)); | 60 base::Bind(&TestTask, 2, &compositor_order)); |
69 | |
70 input_task_runner->PostTask(FROM_HERE, | |
71 base::Bind(&TestTask, 3, &input_order)); | |
72 input_task_runner->PostTask(FROM_HERE, | |
73 base::Bind(&TestTask, 4, &input_order)); | |
74 compositor_task_runner->PostTask(FROM_HERE, | 61 compositor_task_runner->PostTask(FROM_HERE, |
75 base::Bind(&TestTask, 3, &compositor_order)); | 62 base::Bind(&TestTask, 3, &compositor_order)); |
76 compositor_task_runner->PostTask(FROM_HERE, | 63 compositor_task_runner->PostTask(FROM_HERE, |
77 base::Bind(&TestTask, 4, &compositor_order)); | 64 base::Bind(&TestTask, 4, &compositor_order)); |
78 | 65 |
79 message_loop.RunUntilIdle(); | 66 message_loop.RunUntilIdle(); |
80 | 67 |
81 EXPECT_EQ(0x1234, input_order); | |
82 EXPECT_EQ(0x1234, compositor_order); | 68 EXPECT_EQ(0x1234, compositor_order); |
83 } | 69 } |
84 | 70 |
85 } // namespace content | 71 } // namespace content |
OLD | NEW |