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

Side by Side Diff: content/public/test/browser_test_base.cc

Issue 21052007: aura: Clean up compositor initialization/destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanupcompositor: Created 7 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/test/browser_test_base.h" 5 #include "content/public/test/browser_test_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "content/browser/renderer_host/render_process_host_impl.h" 10 #include "content/browser/renderer_host/render_process_host_impl.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "content/public/common/main_function_params.h" 13 #include "content/public/common/main_function_params.h"
14 #include "content/public/test/test_utils.h" 14 #include "content/public/test/test_utils.h"
15 #include "net/test/embedded_test_server/embedded_test_server.h" 15 #include "net/test/embedded_test_server/embedded_test_server.h"
16 #include "ui/compositor/compositor_switches.h"
16 17
17 #if defined(OS_POSIX) 18 #if defined(OS_POSIX)
18 #include "base/process/process_handle.h" 19 #include "base/process/process_handle.h"
19 #endif 20 #endif
20 21
21 #if defined(OS_MACOSX) 22 #if defined(OS_MACOSX)
22 #include "base/mac/mac_util.h" 23 #include "base/mac/mac_util.h"
23 #include "base/power_monitor/power_monitor.h" 24 #include "base/power_monitor/power_monitor.h"
24 #endif 25 #endif
25 26
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task); 58 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, quit_task);
58 } 59 }
59 60
60 } // namespace 61 } // namespace
61 62
62 extern int BrowserMain(const MainFunctionParams&); 63 extern int BrowserMain(const MainFunctionParams&);
63 64
64 BrowserTestBase::BrowserTestBase() 65 BrowserTestBase::BrowserTestBase()
65 : embedded_test_server_( 66 : embedded_test_server_(
66 new net::test_server::EmbeddedTestServer( 67 new net::test_server::EmbeddedTestServer(
67 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))) { 68 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))),
69 allow_test_contexts_(true) {
68 #if defined(OS_MACOSX) 70 #if defined(OS_MACOSX)
69 base::mac::SetOverrideAmIBundled(true); 71 base::mac::SetOverrideAmIBundled(true);
70 base::PowerMonitor::AllocateSystemIOPorts(); 72 base::PowerMonitor::AllocateSystemIOPorts();
71 #endif 73 #endif
72 74
73 #if defined(OS_POSIX) 75 #if defined(OS_POSIX)
74 handle_sigterm_ = true; 76 handle_sigterm_ = true;
75 #endif 77 #endif
76 } 78 }
77 79
(...skipping 13 matching lines...) Expand all
91 93
92 command_line->AppendSwitch(switches::kDomAutomationController); 94 command_line->AppendSwitch(switches::kDomAutomationController);
93 95
94 command_line->AppendSwitch(switches::kSkipGpuDataLoading); 96 command_line->AppendSwitch(switches::kSkipGpuDataLoading);
95 97
96 MainFunctionParams params(*command_line); 98 MainFunctionParams params(*command_line);
97 params.ui_task = 99 params.ui_task =
98 new base::Closure( 100 new base::Closure(
99 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); 101 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this));
100 102
103 #if defined(USE_AURA)
104 // Copy what UITestBase::SetLaunchSwitches() does, and also what
105 // ChromeTestSuite does if the process had went into the test path. Otherwise
106 // tests will fail on bots.
107 if (allow_test_contexts_)
108 command_line->AppendSwitch(switches::kTestCompositor);
109 #endif
110
101 SetUpInProcessBrowserTestFixture(); 111 SetUpInProcessBrowserTestFixture();
102 #if defined(OS_ANDROID) 112 #if defined(OS_ANDROID)
103 BrowserMainRunner::Create()->Initialize(params); 113 BrowserMainRunner::Create()->Initialize(params);
104 // We are done running the test by now. During teardown we 114 // We are done running the test by now. During teardown we
105 // need to be able to perform IO. 115 // need to be able to perform IO.
106 base::ThreadRestrictions::SetIOAllowed(true); 116 base::ThreadRestrictions::SetIOAllowed(true);
107 BrowserThread::PostTask( 117 BrowserThread::PostTask(
108 BrowserThread::IO, FROM_HERE, 118 BrowserThread::IO, FROM_HERE,
109 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed), 119 base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
110 true)); 120 true));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 RenderProcessHostImpl::GetInProcessRendererThreadForTesting(); 156 RenderProcessHostImpl::GetInProcessRendererThreadForTesting();
147 CHECK(renderer_loop); 157 CHECK(renderer_loop);
148 158
149 renderer_loop->PostTask( 159 renderer_loop->PostTask(
150 FROM_HERE, 160 FROM_HERE,
151 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure())); 161 base::Bind(&RunTaskOnRendererThread, task, runner->QuitClosure()));
152 runner->Run(); 162 runner->Run();
153 } 163 }
154 164
155 } // namespace content 165 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698