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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl_browsertest.cc
diff --git a/content/renderer/render_thread_impl_browsertest.cc b/content/renderer/render_thread_impl_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..79eb6bca876af7aa02b467aaa71228f28a7082a6
--- /dev/null
+++ b/content/renderer/render_thread_impl_browsertest.cc
@@ -0,0 +1,62 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "content/public/common/content_switches.h"
+#include "content/public/renderer/content_renderer_client.h"
+#include "content/renderer/render_process_impl.h"
+#include "content/renderer/render_thread_impl.h"
+#include "content/test/mock_render_process.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace content {
+namespace {
+
+class RenderThreadImplBrowserTest : public testing::Test {
+ public:
+ virtual ~RenderThreadImplBrowserTest() {}
+};
+
+class DummyListener : public IPC::Listener {
+ public:
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
+ return true;
+ }
+};
+
+void CheckRenderThreadInputHandlerManager(RenderThreadImpl* thread) {
+ ASSERT_TRUE(thread->input_handler_manager());
+}
+
+// Check that InputHandlerManager outlives compositor thread because it uses
+// raw pointers to post tasks.
+TEST_F(RenderThreadImplBrowserTest,
+ InputHandlerManagerDestroyedAfterCompositorThread) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableThreadedCompositing);
+
+ ContentRendererClient content_renderer_client;
+ SetRendererClientForTesting(&content_renderer_client);
+ MessageLoopForIO message_loop_;
+
+ std::string channel_id = IPC::Channel::GenerateVerifiedChannelID(
+ std::string());
+ DummyListener dummy_listener;
+ IPC::Channel channel(channel_id, IPC::Channel::MODE_SERVER, &dummy_listener);
+ ASSERT_TRUE(channel.Connect());
+
+ scoped_ptr<MockRenderProcess> mock_process(new MockRenderProcess);
+ // Owned by mock_process.
+ RenderThreadImpl* thread = new RenderThreadImpl(channel_id);
+ thread->EnsureWebKitInitialized();
+
+ ASSERT_TRUE(thread->input_handler_manager());
+
+ thread->compositor_message_loop_proxy()->PostTask(
+ FROM_HERE,
+ base::Bind(&CheckRenderThreadInputHandlerManager, thread));
+}
+
+} // namespace
+} // namespace content
« 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