OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_tabstrip.h" | 7 #include "chrome/browser/ui/browser_tabstrip.h" |
8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
9 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 9 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
10 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h" | 10 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 event, | 92 event, |
93 reentrant); | 93 reentrant); |
94 } | 94 } |
95 | 95 |
96 Browser* FullscreenControllerStateInteractiveTest::GetBrowser() { | 96 Browser* FullscreenControllerStateInteractiveTest::GetBrowser() { |
97 return InProcessBrowserTest::browser(); | 97 return InProcessBrowserTest::browser(); |
98 } | 98 } |
99 | 99 |
100 // Tests ----------------------------------------------------------------------- | 100 // Tests ----------------------------------------------------------------------- |
101 | 101 |
| 102 // Soak tests: |
| 103 |
| 104 // Tests all states with all permutations of multiple events to detect lingering |
| 105 // state issues that would bleed over to other states. |
| 106 // I.E. for each state test all combinations of events E1, E2, E3. |
| 107 // |
| 108 // This produces coverage for event sequences that may happen normally but |
| 109 // would not be exposed by traversing to each state via TransitionToState(). |
| 110 // TransitionToState() always takes the same path even when multiple paths |
| 111 // exist. |
| 112 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, |
| 113 DISABLED_TransitionsForEachState) { |
| 114 // A tab is needed for tab fullscreen. |
| 115 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); |
| 116 TestTransitionsForEachState(); |
| 117 // Progress of test can be examined via LOG(INFO) << GetAndClearDebugLog(); |
| 118 } |
| 119 |
| 120 |
| 121 // Individual tests for each pair of state and event: |
| 122 |
102 #define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \ | 123 #define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \ |
103 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, \ | 124 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, \ |
104 DISABLED_##state##__##event##reentrant_id) { \ | 125 DISABLED_##state##__##event##reentrant_id) { \ |
105 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); \ | 126 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); \ |
106 ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \ | 127 ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \ |
107 << GetAndClearDebugLog(); \ | 128 << GetAndClearDebugLog(); \ |
108 } | 129 } |
109 // Progress of tests can be examined by inserting the following line: | 130 // Progress of tests can be examined by inserting the following line: |
110 // LOG(INFO) << GetAndClearDebugLog(); } | 131 // LOG(INFO) << GetAndClearDebugLog(); } |
111 | 132 |
112 #define TEST_EVENT(state, event) \ | 133 #define TEST_EVENT(state, event) \ |
113 TEST_EVENT_INNER(state, event, false, ); \ | 134 TEST_EVENT_INNER(state, event, false, ); \ |
114 TEST_EVENT_INNER(state, event, true, _Reentrant); | 135 TEST_EVENT_INNER(state, event, true, _Reentrant); |
115 | 136 |
116 // Individual tests for each pair of state and event: | |
117 | |
118 TEST_EVENT(STATE_NORMAL, TOGGLE_FULLSCREEN); | 137 TEST_EVENT(STATE_NORMAL, TOGGLE_FULLSCREEN); |
119 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_TRUE); | 138 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_TRUE); |
120 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_FALSE); | 139 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_FALSE); |
121 #if defined(OS_WIN) | 140 #if defined(OS_WIN) |
122 TEST_EVENT(STATE_NORMAL, METRO_SNAP_TRUE); | 141 TEST_EVENT(STATE_NORMAL, METRO_SNAP_TRUE); |
123 TEST_EVENT(STATE_NORMAL, METRO_SNAP_FALSE); | 142 TEST_EVENT(STATE_NORMAL, METRO_SNAP_FALSE); |
124 #endif | 143 #endif |
125 TEST_EVENT(STATE_NORMAL, BUBBLE_EXIT_LINK); | 144 TEST_EVENT(STATE_NORMAL, BUBBLE_EXIT_LINK); |
126 TEST_EVENT(STATE_NORMAL, BUBBLE_ALLOW); | 145 TEST_EVENT(STATE_NORMAL, BUBBLE_ALLOW); |
127 TEST_EVENT(STATE_NORMAL, BUBBLE_DENY); | 146 TEST_EVENT(STATE_NORMAL, BUBBLE_DENY); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, TAB_FULLSCREEN_FALSE); | 223 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, TAB_FULLSCREEN_FALSE); |
205 #if defined(OS_WIN) | 224 #if defined(OS_WIN) |
206 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_TRUE); | 225 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_TRUE); |
207 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_FALSE); | 226 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_FALSE); |
208 #endif | 227 #endif |
209 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_EXIT_LINK); | 228 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_EXIT_LINK); |
210 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_ALLOW); | 229 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_ALLOW); |
211 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_DENY); | 230 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_DENY); |
212 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, WINDOW_CHANGE); | 231 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, WINDOW_CHANGE); |
213 | 232 |
| 233 |
214 // Specific one-off tests for known issues: | 234 // Specific one-off tests for known issues: |
215 | 235 |
216 // Used manually to determine what happens on a platform. | 236 // Used manually to determine what happens on a platform. |
217 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, | 237 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, |
218 DISABLED_ManualTest) { | 238 DISABLED_ManualTest) { |
219 // A tab is needed for tab fullscreen. | 239 // A tab is needed for tab fullscreen. |
220 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); | 240 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); |
221 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)) << GetAndClearDebugLog(); | 241 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)) << GetAndClearDebugLog(); |
222 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); | 242 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); |
223 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog(); | 243 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog(); |
224 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)) << GetAndClearDebugLog(); | 244 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)) << GetAndClearDebugLog(); |
225 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); | 245 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); |
226 | 246 |
227 // Wait, allowing human operator to observe the result. | 247 // Wait, allowing human operator to observe the result. |
228 scoped_refptr<content::MessageLoopRunner> message_loop; | 248 scoped_refptr<content::MessageLoopRunner> message_loop; |
229 message_loop = new content::MessageLoopRunner(); | 249 message_loop = new content::MessageLoopRunner(); |
230 message_loop->Run(); | 250 message_loop->Run(); |
231 } | 251 } |
232 | 252 |
233 // Soak tests: | |
234 | |
235 // Tests all states with all permutations of multiple events to detect lingering | |
236 // state issues that would bleed over to other states. | |
237 // I.E. for each state test all combinations of events E1, E2, E3. | |
238 // | |
239 // This produces coverage for event sequences that may happen normally but | |
240 // would not be exposed by traversing to each state via TransitionToState(). | |
241 // TransitionToState() always takes the same path even when multiple paths | |
242 // exist. | |
243 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, | |
244 DISABLED_TransitionsForEachState) { | |
245 // A tab is needed for tab fullscreen. | |
246 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); | |
247 TestTransitionsForEachState(); | |
248 // Progress of test can be examined via LOG(INFO) << GetAndClearDebugLog(); | |
249 } | |
250 | |
OLD | NEW |