Re-subimission of https://codereview.chromium.org/1041213003/
[chromium-blink-merge.git] / content / public / test / nested_message_pump_android.h
blob4346c83c1952e600c12e6388d7b14cb6db9f1152
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.
5 #ifndef CONTENT_PUBLIC_TEST_NESTED_MESSAGE_PUMP_ANDROID_H_
6 #define CONTENT_PUBLIC_TEST_NESTED_MESSAGE_PUMP_ANDROID_H_
8 #include "base/android/jni_android.h"
9 #include "base/compiler_specific.h"
10 #include "base/message_loop/message_pump_android.h"
12 namespace content {
14 // A nested message pump to be used for content browsertests and layout tests
15 // on Android. It overrides the default UI message pump to allow nested loops.
16 class NestedMessagePumpAndroid : public base::MessagePumpForUI {
17 public:
18 NestedMessagePumpAndroid();
20 void Run(Delegate* delegate) override;
21 void Quit() override;
22 void ScheduleWork() override;
23 void ScheduleDelayedWork(const base::TimeTicks& delayed_work_time) override;
24 void Start(Delegate* delegate) override;
26 static bool RegisterJni(JNIEnv* env);
28 protected:
29 ~NestedMessagePumpAndroid() override;
31 private:
32 // We may make recursive calls to Run, so we save state that needs to be
33 // separate between them in this structure type.
34 struct RunState;
36 RunState* state_;
38 DISALLOW_COPY_AND_ASSIGN(NestedMessagePumpAndroid);
41 } // namespace content
43 #endif // CONTENT_PUBLIC_TEST_NESTED_MESSAGE_PUMP_ANDROID_H_