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

Side by Side Diff: base/android/java_handler_thread_for_testing.cc

Issue 2169553002: Properly throw java exceptions from shouldOverrideUrlLoading (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test-only subclasses for JavaHandlerThread and SystemMessageHandler. Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 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/android/java_handler_thread_for_testing.h"
6
7 #include "base/message_loop/message_loop.h"
8
9 namespace base {
10
11 namespace android {
12
13 JavaHandlerThreadForTesting::JavaHandlerThreadForTesting(
14 const char* name,
15 base::WaitableEvent* test_done_event)
16 : JavaHandlerThread(name), test_done_event_(test_done_event) {}
17
18 JavaHandlerThreadForTesting::~JavaHandlerThreadForTesting() {}
19
20 void JavaHandlerThreadForTesting::StartMessageLoop() {
21 static_cast<MessageLoopForUI*>(message_loop_.get())
22 ->StartForTesting(
23 reinterpret_cast<base::WaitableEvent*>(test_done_event_));
24 }
25
26 void JavaHandlerThreadForTesting::StopMessageLoop() {
27 // Instead of calling MessageLoop::QuitWhenIdle here we call
28 // MessageLoop::QuitNow. This is because QuitWhenIdle will have no effect on
29 // the message loop after MessageLoop::Abort has been called (which should
30 // have happened at this point).
31 static_cast<MessageLoopForUI*>(message_loop_.get())->QuitNow();
32 // The message loop must be destroyed on the thread it is attached to.
33 message_loop_.reset();
34 }
35
36 } // namespace base
37 } // namespace android
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698