OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef CONTENT_TEST_BROWSER_TEST_MESSAGE_PUMP_ANDROID_ | 5 #ifndef CONTENT_TEST_BROWSER_TEST_MESSAGE_PUMP_ANDROID_ |
6 #define CONTENT_TEST_BROWSER_TEST_MESSAGE_PUMP_ANDROID_ | 6 #define CONTENT_TEST_BROWSER_TEST_MESSAGE_PUMP_ANDROID_ |
7 | 7 |
| 8 #include "base/android/jni_android.h" |
8 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
9 #include "base/message_pump_android.h" | 10 #include "base/message_pump_android.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 | 13 |
13 // MessgePump to be used for content browsertests on Android. | 14 // MessgePump to be used for content browsertests on Android. |
14 // This overrides the default ui message pump to allow nested loops. | 15 // This overrides the default ui message pump to allow nested loops. |
15 // Currently only native side messages are processed when running in nested | |
16 // mode. | |
17 // TODO(nileshagrawal): Add processing of messages on the Java side. | |
18 class BrowserTestMessagePumpAndroid : public base::MessagePumpForUI { | 16 class BrowserTestMessagePumpAndroid : public base::MessagePumpForUI { |
19 public: | 17 public: |
20 BrowserTestMessagePumpAndroid(); | 18 BrowserTestMessagePumpAndroid(); |
21 | 19 |
22 virtual void Run(Delegate* delegate) OVERRIDE; | 20 virtual void Run(Delegate* delegate) OVERRIDE; |
23 virtual void Quit() OVERRIDE; | 21 virtual void Quit() OVERRIDE; |
24 virtual void ScheduleWork() OVERRIDE; | 22 virtual void ScheduleWork() OVERRIDE; |
25 virtual void ScheduleDelayedWork( | 23 virtual void ScheduleDelayedWork( |
26 const base::TimeTicks& delayed_work_time) OVERRIDE; | 24 const base::TimeTicks& delayed_work_time) OVERRIDE; |
| 25 virtual void Start(Delegate* delegate) OVERRIDE; |
| 26 |
| 27 static bool RegisterJni(JNIEnv* env); |
27 | 28 |
28 protected: | 29 protected: |
29 virtual ~BrowserTestMessagePumpAndroid(); | 30 virtual ~BrowserTestMessagePumpAndroid(); |
30 | 31 |
31 private: | 32 private: |
32 // We may make recursive calls to Run, so we save state that needs to be | 33 // We may make recursive calls to Run, so we save state that needs to be |
33 // separate between them in this structure type. | 34 // separate between them in this structure type. |
34 struct RunState; | 35 struct RunState; |
35 | 36 |
36 RunState* state_; | 37 RunState* state_; |
37 | 38 |
38 DISALLOW_COPY_AND_ASSIGN(BrowserTestMessagePumpAndroid); | 39 DISALLOW_COPY_AND_ASSIGN(BrowserTestMessagePumpAndroid); |
39 }; | 40 }; |
40 | 41 |
41 } // namespace content | 42 } // namespace content |
42 | 43 |
43 #endif // CONTENT_TEST_BROWSER_TEST_MESSAGE_PUMP_ANDROID_ | 44 #endif // CONTENT_TEST_BROWSER_TEST_MESSAGE_PUMP_ANDROID_ |
OLD | NEW |