Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1047)

Side by Side Diff: chrome/browser/ui/fullscreen/fullscreen_controller_state_unittest.cc

Issue 12018002: Adjust test ordering in fullscreen_controller_state_ tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/fullscreen/fullscreen_controller_state_interactive_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/fullscreen/fullscreen_controller.h" 8 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
9 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h" 9 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h"
10 #include "chrome/test/base/browser_with_test_window_test.h" 10 #include "chrome/test/base/browser_with_test_window_test.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 window_->set_reentrant(reentrant); 310 window_->set_reentrant(reentrant);
311 FullscreenControllerStateTest::TestStateAndEvent(state, event, reentrant); 311 FullscreenControllerStateTest::TestStateAndEvent(state, event, reentrant);
312 } 312 }
313 313
314 Browser* FullscreenControllerStateUnitTest::GetBrowser() { 314 Browser* FullscreenControllerStateUnitTest::GetBrowser() {
315 return BrowserWithTestWindowTest::browser(); 315 return BrowserWithTestWindowTest::browser();
316 } 316 }
317 317
318 // Tests ----------------------------------------------------------------------- 318 // Tests -----------------------------------------------------------------------
319 319
320 // Soak tests:
321
322 // Tests all states with all permutations of multiple events to detect lingering
323 // state issues that would bleed over to other states.
324 // I.E. for each state test all combinations of events E1, E2, E3.
325 //
326 // This produces coverage for event sequences that may happen normally but
327 // would not be exposed by traversing to each state via TransitionToState().
328 // TransitionToState() always takes the same path even when multiple paths
329 // exist.
330 TEST_F(FullscreenControllerStateUnitTest, TransitionsForEachState) {
331 // A tab is needed for tab fullscreen.
332 AddTab(browser(), GURL(chrome::kAboutBlankURL));
333 TestTransitionsForEachState();
334 // Progress of test can be examined via LOG(INFO) << GetAndClearDebugLog();
335 }
336
337
338 // Individual tests for each pair of state and event:
339
320 #define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \ 340 #define TEST_EVENT_INNER(state, event, reentrant, reentrant_id) \
321 TEST_F(FullscreenControllerStateUnitTest, \ 341 TEST_F(FullscreenControllerStateUnitTest, \
322 state##__##event##reentrant_id) { \ 342 state##__##event##reentrant_id) { \
323 AddTab(browser(), GURL(chrome::kAboutBlankURL)); \ 343 AddTab(browser(), GURL(chrome::kAboutBlankURL)); \
324 ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \ 344 ASSERT_NO_FATAL_FAILURE(TestStateAndEvent(state, event, reentrant)) \
325 << GetAndClearDebugLog(); \ 345 << GetAndClearDebugLog(); \
326 } 346 }
327 // Progress of tests can be examined by inserting the following line: 347 // Progress of tests can be examined by inserting the following line:
328 // LOG(INFO) << GetAndClearDebugLog(); } 348 // LOG(INFO) << GetAndClearDebugLog(); }
329 349
330 #define TEST_EVENT(state, event) \ 350 #define TEST_EVENT(state, event) \
331 TEST_EVENT_INNER(state, event, false, ); \ 351 TEST_EVENT_INNER(state, event, false, ); \
332 TEST_EVENT_INNER(state, event, true, _Reentrant); 352 TEST_EVENT_INNER(state, event, true, _Reentrant);
333 353
334 // Individual tests for each pair of state and event:
335
336 TEST_EVENT(STATE_NORMAL, TOGGLE_FULLSCREEN); 354 TEST_EVENT(STATE_NORMAL, TOGGLE_FULLSCREEN);
337 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_TRUE); 355 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_TRUE);
338 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_FALSE); 356 TEST_EVENT(STATE_NORMAL, TAB_FULLSCREEN_FALSE);
339 #if defined(OS_WIN) 357 #if defined(OS_WIN)
340 TEST_EVENT(STATE_NORMAL, METRO_SNAP_TRUE); 358 TEST_EVENT(STATE_NORMAL, METRO_SNAP_TRUE);
341 TEST_EVENT(STATE_NORMAL, METRO_SNAP_FALSE); 359 TEST_EVENT(STATE_NORMAL, METRO_SNAP_FALSE);
342 #endif 360 #endif
343 TEST_EVENT(STATE_NORMAL, BUBBLE_EXIT_LINK); 361 TEST_EVENT(STATE_NORMAL, BUBBLE_EXIT_LINK);
344 TEST_EVENT(STATE_NORMAL, BUBBLE_ALLOW); 362 TEST_EVENT(STATE_NORMAL, BUBBLE_ALLOW);
345 TEST_EVENT(STATE_NORMAL, BUBBLE_DENY); 363 TEST_EVENT(STATE_NORMAL, BUBBLE_DENY);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, TAB_FULLSCREEN_FALSE); 440 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, TAB_FULLSCREEN_FALSE);
423 #if defined(OS_WIN) 441 #if defined(OS_WIN)
424 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_TRUE); 442 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_TRUE);
425 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_FALSE); 443 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, METRO_SNAP_FALSE);
426 #endif 444 #endif
427 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_EXIT_LINK); 445 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_EXIT_LINK);
428 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_ALLOW); 446 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_ALLOW);
429 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_DENY); 447 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, BUBBLE_DENY);
430 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, WINDOW_CHANGE); 448 TEST_EVENT(STATE_TO_TAB_FULLSCREEN, WINDOW_CHANGE);
431 449
450
432 // Specific one-off tests for known issues: 451 // Specific one-off tests for known issues:
433 452
434 // TODO(scheib) Toggling Tab fullscreen while pending Tab or 453 // TODO(scheib) Toggling Tab fullscreen while pending Tab or
435 // Browser fullscreen is broken currently http://crbug.com/154196 454 // Browser fullscreen is broken currently http://crbug.com/154196
436 TEST_F(FullscreenControllerStateUnitTest, 455 TEST_F(FullscreenControllerStateUnitTest,
437 DISABLED_ToggleTabWhenPendingBrowser) { 456 DISABLED_ToggleTabWhenPendingBrowser) {
438 #if !defined(OS_WIN) // Only possible without reentrancy 457 #if !defined(OS_WIN) // Only possible without reentrancy
439 AddTab(browser(), GURL(chrome::kAboutBlankURL)); 458 AddTab(browser(), GURL(chrome::kAboutBlankURL));
440 ASSERT_NO_FATAL_FAILURE( 459 ASSERT_NO_FATAL_FAILURE(
441 TransitionToState(STATE_TO_BROWSER_FULLSCREEN_NO_CHROME)) 460 TransitionToState(STATE_TO_BROWSER_FULLSCREEN_NO_CHROME))
(...skipping 13 matching lines...) Expand all
455 ASSERT_NO_FATAL_FAILURE( 474 ASSERT_NO_FATAL_FAILURE(
456 TransitionToState(STATE_TO_TAB_FULLSCREEN)) 475 TransitionToState(STATE_TO_TAB_FULLSCREEN))
457 << GetAndClearDebugLog(); 476 << GetAndClearDebugLog();
458 477
459 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog(); 478 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_TRUE)) << GetAndClearDebugLog();
460 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_FALSE)) << GetAndClearDebugLog(); 479 ASSERT_TRUE(InvokeEvent(TAB_FULLSCREEN_FALSE)) << GetAndClearDebugLog();
461 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog(); 480 ASSERT_TRUE(InvokeEvent(WINDOW_CHANGE)) << GetAndClearDebugLog();
462 #endif 481 #endif
463 } 482 }
464 483
465 // Soak tests:
466
467 // Tests all states with all permutations of multiple events to detect lingering
468 // state issues that would bleed over to other states.
469 // I.E. for each state test all combinations of events E1, E2, E3.
470 //
471 // This produces coverage for event sequences that may happen normally but
472 // would not be exposed by traversing to each state via TransitionToState().
473 // TransitionToState() always takes the same path even when multiple paths
474 // exist.
475 TEST_F(FullscreenControllerStateUnitTest, TransitionsForEachState) {
476 // A tab is needed for tab fullscreen.
477 AddTab(browser(), GURL(chrome::kAboutBlankURL));
478 TestTransitionsForEachState();
479 // Progress of test can be examined via LOG(INFO) << GetAndClearDebugLog();
480 }
481
OLDNEW
« no previous file with comments | « chrome/browser/ui/fullscreen/fullscreen_controller_state_interactive_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698