Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: content/renderer/render_thread_impl_browsertest.cc

Issue 13650004: Destroy InputHandlerManager after compositor thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test that is flaky without fix Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "content/public/common/content_switches.h"
7 #include "content/public/renderer/content_renderer_client.h"
8 #include "content/renderer/render_process_impl.h"
9 #include "content/renderer/render_thread_impl.h"
10 #include "content/test/mock_render_process.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace content {
14 namespace {
15
16 class RenderThreadImplBrowserTest : public testing::Test {
17 public:
18 virtual ~RenderThreadImplBrowserTest() {}
19 };
20
21 class DummyListener : public IPC::Listener {
22 public:
23 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
24 return true;
25 }
26 };
27
28 void CheckRenderThreadInputHandlerManager(RenderThreadImpl* thread) {
29 ASSERT_TRUE(thread->input_handler_manager());
30 }
31
32 // Check that InputHandlerManager outlives compositor thread because it uses
33 // raw pointers to post tasks.
34 TEST_F(RenderThreadImplBrowserTest,
35 InputHandlerManagerDestroyedAfterCompositorThread) {
36 CommandLine::ForCurrentProcess()->AppendSwitch(
37 switches::kEnableThreadedCompositing);
38
39 ContentRendererClient content_renderer_client;
40 SetRendererClientForTesting(&content_renderer_client);
41 MessageLoopForIO message_loop_;
42
43 std::string channel_id = IPC::Channel::GenerateVerifiedChannelID(
44 std::string());
45 DummyListener dummy_listener;
46 IPC::Channel channel(channel_id, IPC::Channel::MODE_SERVER, &dummy_listener);
47 ASSERT_TRUE(channel.Connect());
48
49 scoped_ptr<MockRenderProcess> mock_process(new MockRenderProcess);
50 // Owned by mock_process.
51 RenderThreadImpl* thread = new RenderThreadImpl(channel_id);
52 thread->EnsureWebKitInitialized();
53
54 ASSERT_TRUE(thread->input_handler_manager());
55
56 thread->compositor_message_loop_proxy()->PostTask(
57 FROM_HERE,
58 base::Bind(&CheckRenderThreadInputHandlerManager, thread));
59 }
60
61 } // namespace
62 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698