| 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 | |
| 123 #define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \ | 102 #define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \ |
| 124 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, \ | 103 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, \ |
| 125 DISABLED_##state##__##event##reentrant_id) { \ | 104 DISABLED_##state##__##event##reentrant_id) { \ |
| 126 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); \ | 105 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); \ |
| 127 ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \ | 106 ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \ |
| 128 << GetAndClearDebugLog(); \ | 107 << GetAndClearDebugLog(); \ |
| 129 } | 108 } |
| 130 // Progress of tests can be examined by inserting the following line: | 109 // Progress of tests can be examined by inserting the following line: |
| 131 // LOG(INFO) << GetAndClearDebugLog(); } | 110 // LOG(INFO) << GetAndClearDebugLog(); } |
| 132 | 111 |
| 133 #define TEST_EVENT(state, event) \ | 112 #define TEST_EVENT(state, event) \ |
| 134 TEST_EVENT_INNER(state, event, false, ); \ | 113 TEST_EVENT_INNER(state, event, false, ); \ |
| 135 TEST_EVENT_INNER(state, event, true, _Reentrant); | 114 TEST_EVENT_INNER(state, event, true, _Reentrant); |
| 136 | 115 |
| 116 // Individual tests for each pair of state and event: |
| 117 |
| 137 TEST_EVENT(STATE_NORMAL, TOGGLE_FULLSCREEN); | 118 TEST_EVENT(STATE_NORMAL, TOGGLE_FULLSCREEN); |
| 138 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_TRUE); | 119 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_TRUE); |
| 139 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_FALSE); | 120 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_FALSE); |
| 140 #if defined(OS_WIN) | 121 #if defined(OS_WIN) |
| 141 TEST_EVENT(STATE_NORMAL, METRO_SNAP_TRUE); | 122 TEST_EVENT(STATE_NORMAL, METRO_SNAP_TRUE); |
| 142 TEST_EVENT(STATE_NORMAL, METRO_SNAP_FALSE); | 123 TEST_EVENT(STATE_NORMAL, METRO_SNAP_FALSE); |
| 143 #endif | 124 #endif |
| 144 TEST_EVENT(STATE_NORMAL, BUBBLE_EXIT_LINK); | 125 TEST_EVENT(STATE_NORMAL, BUBBLE_EXIT_LINK); |
| 145 TEST_EVENT(STATE_NORMAL, BUBBLE_ALLOW); | 126 TEST_EVENT(STATE_NORMAL, BUBBLE_ALLOW); |
| 146 TEST_EVENT(STATE_NORMAL, BUBBLE_DENY); | 127 TEST_EVENT(STATE_NORMAL, BUBBLE_DENY); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, TAB_FULLSCREEN_FALSE); | 204 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, TAB_FULLSCREEN_FALSE); |
| 224 #if defined(OS_WIN) | 205 #if defined(OS_WIN) |
| 225 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_TRUE); | 206 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_TRUE); |
| 226 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_FALSE); | 207 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_FALSE); |
| 227 #endif | 208 #endif |
| 228 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_EXIT_LINK); | 209 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_EXIT_LINK); |
| 229 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_ALLOW); | 210 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_ALLOW); |
| 230 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_DENY); | 211 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_DENY); |
| 231 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, WINDOW_CHANGE); | 212 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, WINDOW_CHANGE); |
| 232 | 213 |
| 233 | |
| 234 // Specific one-off tests for known issues: | 214 // Specific one-off tests for known issues: |
| 235 | 215 |
| 236 // Used manually to determine what happens on a platform. | 216 // Used manually to determine what happens on a platform. |
| 237 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, | 217 IN_PROC_BROWSER_TEST_F(FullscreenControllerStateInteractiveTest, |
| 238 DISABLED_ManualTest) { | 218 DISABLED_ManualTest) { |
| 239 // A tab is needed for tab fullscreen. | 219 // A tab is needed for tab fullscreen. |
| 240 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); | 220 AddTabAtIndex(0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); |
| 241 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)) << GetAndClearDebugLog(); | 221 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)) << GetAndClearDebugLog(); |
| 242 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); | 222 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); |
| 243 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog(); | 223 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog(); |
| 244 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)) << GetAndClearDebugLog(); | 224 ASSERT_TRUE(InvokeEvent(TOGGLE_FULLSCREEN)) << GetAndClearDebugLog(); |
| 245 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); | 225 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); |
| 246 | 226 |
| 247 // Wait, allowing human operator to observe the result. | 227 // Wait, allowing human operator to observe the result. |
| 248 scoped_refptr<content::MessageLoopRunner> message_loop; | 228 scoped_refptr<content::MessageLoopRunner> message_loop; |
| 249 message_loop = new content::MessageLoopRunner(); | 229 message_loop = new content::MessageLoopRunner(); |
| 250 message_loop->Run(); | 230 message_loop->Run(); |
| 251 } | 231 } |
| 252 | 232 |
| 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 |