Add text continuation to app info dialog buttons
[chromium-blink-merge.git] / base / message_loop / message_loop_test.h
blob3d9889cd58dd88f2dcda9a16fed2378b16ed458f
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 BASE_MESSAGE_LOOP_MESSAGE_LOOP_TEST_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_TEST_H_
8 #include "base/message_loop/message_loop.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 // This file consists of tests meant to exercise the combination of MessageLoop
12 // and MessagePump. To use these define the macro RUN_MESSAGE_LOOP_TESTS using
13 // an ID appropriate for your MessagePump, eg
14 // RUN_MESSAGE_LOOP_TESTS(UI, factory). Factory is a function called to create
15 // the MessagePump.
16 namespace base {
17 namespace test {
19 typedef MessageLoop::MessagePumpFactory MessagePumpFactory;
21 void RunTest_PostTask(MessagePumpFactory factory);
22 void RunTest_PostDelayedTask_Basic(MessagePumpFactory factory);
23 void RunTest_PostDelayedTask_InDelayOrder(MessagePumpFactory factory);
24 void RunTest_PostDelayedTask_InPostOrder(MessagePumpFactory factory);
25 void RunTest_PostDelayedTask_InPostOrder_2(MessagePumpFactory factory);
26 void RunTest_PostDelayedTask_InPostOrder_3(MessagePumpFactory factory);
27 void RunTest_PostDelayedTask_SharedTimer(MessagePumpFactory factory);
28 void RunTest_EnsureDeletion(MessagePumpFactory factory);
29 void RunTest_EnsureDeletion_Chain(MessagePumpFactory factory);
30 void RunTest_Nesting(MessagePumpFactory factory);
31 void RunTest_RecursiveDenial1(MessagePumpFactory factory);
32 void RunTest_RecursiveDenial3(MessagePumpFactory factory);
33 void RunTest_RecursiveSupport1(MessagePumpFactory factory);
34 void RunTest_NonNestableWithNoNesting(MessagePumpFactory factory);
35 void RunTest_NonNestableInNestedLoop(MessagePumpFactory factory,
36 bool use_delayed);
37 void RunTest_QuitNow(MessagePumpFactory factory);
38 void RunTest_RunLoopQuitTop(MessagePumpFactory factory);
39 void RunTest_RunLoopQuitNested(MessagePumpFactory factory);
40 void RunTest_RunLoopQuitBogus(MessagePumpFactory factory);
41 void RunTest_RunLoopQuitDeep(MessagePumpFactory factory);
42 void RunTest_RunLoopQuitOrderBefore(MessagePumpFactory factory);
43 void RunTest_RunLoopQuitOrderDuring(MessagePumpFactory factory);
44 void RunTest_RunLoopQuitOrderAfter(MessagePumpFactory factory);
45 void RunTest_RecursivePosts(MessagePumpFactory factory);
47 } // namespace test
48 } // namespace base
50 #define RUN_MESSAGE_LOOP_TESTS(id, factory) \
51 TEST(MessageLoopTestType##id, PostTask) { \
52 base::test::RunTest_PostTask(factory); \
53 } \
54 TEST(MessageLoopTestType##id, PostDelayedTask_Basic) { \
55 base::test::RunTest_PostDelayedTask_Basic(factory); \
56 } \
57 TEST(MessageLoopTestType##id, PostDelayedTask_InDelayOrder) { \
58 base::test::RunTest_PostDelayedTask_InDelayOrder(factory); \
59 } \
60 TEST(MessageLoopTestType##id, PostDelayedTask_InPostOrder) { \
61 base::test::RunTest_PostDelayedTask_InPostOrder(factory); \
62 } \
63 TEST(MessageLoopTestType##id, PostDelayedTask_InPostOrder_2) { \
64 base::test::RunTest_PostDelayedTask_InPostOrder_2(factory); \
65 } \
66 TEST(MessageLoopTestType##id, PostDelayedTask_InPostOrder_3) { \
67 base::test::RunTest_PostDelayedTask_InPostOrder_3(factory); \
68 } \
69 TEST(MessageLoopTestType##id, PostDelayedTask_SharedTimer) { \
70 base::test::RunTest_PostDelayedTask_SharedTimer(factory); \
71 } \
72 /* TODO(darin): MessageLoop does not support deleting all tasks in the */ \
73 /* destructor. */ \
74 /* Fails, http://crbug.com/50272. */ \
75 TEST(MessageLoopTestType##id, DISABLED_EnsureDeletion) { \
76 base::test::RunTest_EnsureDeletion(factory); \
77 } \
78 /* TODO(darin): MessageLoop does not support deleting all tasks in the */ \
79 /* destructor. */ \
80 /* Fails, http://crbug.com/50272. */ \
81 TEST(MessageLoopTestType##id, DISABLED_EnsureDeletion_Chain) { \
82 base::test::RunTest_EnsureDeletion_Chain(factory); \
83 } \
84 TEST(MessageLoopTestType##id, Nesting) { \
85 base::test::RunTest_Nesting(factory); \
86 } \
87 TEST(MessageLoopTestType##id, RecursiveDenial1) { \
88 base::test::RunTest_RecursiveDenial1(factory); \
89 } \
90 TEST(MessageLoopTestType##id, RecursiveDenial3) { \
91 base::test::RunTest_RecursiveDenial3(factory); \
92 } \
93 TEST(MessageLoopTestType##id, RecursiveSupport1) { \
94 base::test::RunTest_RecursiveSupport1(factory); \
95 } \
96 TEST(MessageLoopTestType##id, NonNestableWithNoNesting) { \
97 base::test::RunTest_NonNestableWithNoNesting(factory); \
98 } \
99 TEST(MessageLoopTestType##id, NonNestableInNestedLoop) { \
100 base::test::RunTest_NonNestableInNestedLoop(factory, false); \
102 TEST(MessageLoopTestType##id, NonNestableDelayedInNestedLoop) { \
103 base::test::RunTest_NonNestableInNestedLoop(factory, true); \
105 TEST(MessageLoopTestType##id, QuitNow) { \
106 base::test::RunTest_QuitNow(factory); \
108 TEST(MessageLoopTestType##id, RunLoopQuitTop) { \
109 base::test::RunTest_RunLoopQuitTop(factory); \
111 TEST(MessageLoopTestType##id, RunLoopQuitNested) { \
112 base::test::RunTest_RunLoopQuitNested(factory); \
114 TEST(MessageLoopTestType##id, RunLoopQuitBogus) { \
115 base::test::RunTest_RunLoopQuitBogus(factory); \
117 TEST(MessageLoopTestType##id, RunLoopQuitDeep) { \
118 base::test::RunTest_RunLoopQuitDeep(factory); \
120 TEST(MessageLoopTestType##id, RunLoopQuitOrderBefore) { \
121 base::test::RunTest_RunLoopQuitOrderBefore(factory); \
123 TEST(MessageLoopTestType##id, RunLoopQuitOrderDuring) { \
124 base::test::RunTest_RunLoopQuitOrderDuring(factory); \
126 TEST(MessageLoopTestType##id, RunLoopQuitOrderAfter) { \
127 base::test::RunTest_RunLoopQuitOrderAfter(factory); \
129 TEST(MessageLoopTestType##id, RecursivePosts) { \
130 base::test::RunTest_RecursivePosts(factory); \
133 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_TEST_H_