Commit d2cdd961 authored by starodub@google.com's avatar starodub@google.com

Calling Shutdown() for Android content_browsertests. Removed webrtc test hack.

Should be landed after:
https://codereview.chromium.org/323513003/
https://codereview.chromium.org/314293004/

which fix related shutdown issues.

BUG=367409,373249

Review URL: https://codereview.chromium.org/319053006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277998 0039d316-1c4b-4281-b951-d872f2087c98
parent 97276a0e
......@@ -46,8 +46,9 @@ class SystemMessageHandler extends Handler {
@SuppressWarnings("unused")
@CalledByNative
private void removeScheduledWork() {
private void removeAllPendingMessages() {
removeMessages(SCHEDULED_WORK);
removeMessages(DELAYED_SCHEDULED_WORK);
}
@CalledByNative
......
......@@ -117,7 +117,7 @@ void MessagePumpForUI::Quit() {
JNIEnv* env = base::android::AttachCurrentThread();
DCHECK(env);
Java_SystemMessageHandler_removeScheduledWork(env,
Java_SystemMessageHandler_removeAllPendingMessages(env,
system_message_handler_obj_.obj());
system_message_handler_obj_.Reset();
}
......
......@@ -149,7 +149,12 @@ class BrowserMainRunnerImpl : public BrowserMainRunner {
#if defined(OS_WIN)
ole_initializer_.reset(NULL);
#endif
#if defined(OS_ANDROID)
// Forcefully terminates the RunLoop inside MessagePumpForUI, ensuring
// proper shutdown for content_browsertests. Shutdown() is not used by
// the actual browser.
base::MessageLoop::current()->QuitNow();
#endif
main_loop_.reset(NULL);
notification_service_.reset(NULL);
......
......@@ -47,19 +47,7 @@ class WebRtcBrowserTest : public WebRtcContentBrowserTest,
command_line->AppendSwitch(switches::kDisableAudioTrackProcessing);
}
virtual void TearDownOnMainThread() OVERRIDE {
#if defined(OS_ANDROID)
// TODO(phoglund): this is a ugly workaround to let the IO thread
// finish its work. The reason we need this on Android is that
// content_browsertests tearDown logic is broken with respect
// to threading, which causes the IO thread to compete with the
// teardown. See http://crbug.com/362852. I also tried with 2
// seconds, but that isn't enough.
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(5));
#endif
}
// Convenience method since most peerconnection-call.html tests just load
// Convenience function since most peerconnection-call.html tests just load
// the page, kick off some javascript and wait for the title to change to OK.
void MakeTypicalPeerConnectionCall(const std::string& javascript) {
ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
......
......@@ -239,14 +239,7 @@ void BrowserTestBase::SetUp() {
MainFunctionParams params(*command_line);
params.ui_task = ui_task;
// TODO(phajdan.jr): Check return code, http://crbug.com/374738 .
BrowserMainRunner::Create()->Initialize(params);
// We are done running the test by now. During teardown we
// need to be able to perform IO.
base::ThreadRestrictions::SetIOAllowed(true);
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
true));
BrowserMain(params);
#else
GetContentMainParams()->ui_task = ui_task;
EXPECT_EQ(expected_exit_code_, ContentMain(*GetContentMainParams()));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment