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 "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h" | 5 #include "chrome/browser/ui/fullscreen/fullscreen_controller_state_test.h" |
6 | 6 |
7 #include <memory.h> | 7 #include <memory.h> |
8 | 8 |
9 #include <iomanip> | 9 #include <iomanip> |
10 #include <iostream> | 10 #include <iostream> |
11 | 11 |
| 12 #include "chrome/browser/fullscreen.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 15 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
15 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" | 16 #include "chrome/browser/ui/fullscreen/fullscreen_controller_test.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
20 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
21 #include "base/mac/mac_util.h" | 22 #include "base/mac/mac_util.h" |
22 #endif | 23 #endif |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 bool IsMacOSLionOrLater() { | 27 bool SupportsMacSystemFullscreen() { |
27 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
28 return base::mac::IsOSLionOrLater(); | 29 return chrome::mac::SupportsSystemFullscreen(); |
29 #else | 30 #else |
30 return false; | 31 return false; |
31 #endif | 32 #endif |
32 } | 33 } |
33 | 34 |
34 } // namespace | 35 } // namespace |
35 | 36 |
36 FullscreenControllerStateTest::FullscreenControllerStateTest() | 37 FullscreenControllerStateTest::FullscreenControllerStateTest() |
37 : state_(STATE_NORMAL), | 38 : state_(STATE_NORMAL), |
38 last_notification_received_state_(STATE_NORMAL) { | 39 last_notification_received_state_(STATE_NORMAL) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 << std::setw(MAX_STATE_NAME_LENGTH) << GetStateString(next_state); | 387 << std::setw(MAX_STATE_NAME_LENGTH) << GetStateString(next_state); |
387 | 388 |
388 state_ = next_state; | 389 state_ = next_state; |
389 | 390 |
390 switch (event) { | 391 switch (event) { |
391 case TOGGLE_FULLSCREEN: | 392 case TOGGLE_FULLSCREEN: |
392 GetFullscreenController()->ToggleFullscreenMode(); | 393 GetFullscreenController()->ToggleFullscreenMode(); |
393 break; | 394 break; |
394 case TOGGLE_FULLSCREEN_CHROME: | 395 case TOGGLE_FULLSCREEN_CHROME: |
395 #if defined(OS_MACOSX) | 396 #if defined(OS_MACOSX) |
396 if (base::mac::IsOSLionOrLater()) { | 397 if (chrome::mac::SupportsSystemFullscreen()) { |
397 GetFullscreenController()->ToggleFullscreenWithChrome(); | 398 GetFullscreenController()->ToggleFullscreenWithChrome(); |
398 break; | 399 break; |
399 } | 400 } |
400 #endif | 401 #endif |
401 NOTREACHED() << GetAndClearDebugLog(); | 402 NOTREACHED() << GetAndClearDebugLog(); |
402 break; | 403 break; |
403 case TAB_FULLSCREEN_TRUE: | 404 case TAB_FULLSCREEN_TRUE: |
404 GetFullscreenController()->ToggleFullscreenModeForTab( | 405 GetFullscreenController()->ToggleFullscreenModeForTab( |
405 GetBrowser()->tab_strip_model()->GetActiveWebContents(), true); | 406 GetBrowser()->tab_strip_model()->GetActiveWebContents(), true); |
406 break; | 407 break; |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 | 728 |
728 // Skip metro snap state and events when not on windows. | 729 // Skip metro snap state and events when not on windows. |
729 #if !defined(OS_WIN) | 730 #if !defined(OS_WIN) |
730 if (state == STATE_METRO_SNAP || | 731 if (state == STATE_METRO_SNAP || |
731 event == METRO_SNAP_TRUE || | 732 event == METRO_SNAP_TRUE || |
732 event == METRO_SNAP_FALSE) | 733 event == METRO_SNAP_FALSE) |
733 return true; | 734 return true; |
734 #endif | 735 #endif |
735 | 736 |
736 // Skip Mac Lion Fullscreen state and events when not on OSX 10.7+. | 737 // Skip Mac Lion Fullscreen state and events when not on OSX 10.7+. |
737 if (!IsMacOSLionOrLater()) { | 738 if (!SupportsMacSystemFullscreen()) { |
738 if (state == STATE_BROWSER_FULLSCREEN_WITH_CHROME || | 739 if (state == STATE_BROWSER_FULLSCREEN_WITH_CHROME || |
739 state == STATE_TAB_BROWSER_FULLSCREEN_CHROME || | 740 state == STATE_TAB_BROWSER_FULLSCREEN_CHROME || |
740 state == STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME || | 741 state == STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME || |
741 event == TOGGLE_FULLSCREEN_CHROME) { | 742 event == TOGGLE_FULLSCREEN_CHROME) { |
742 return true; | 743 return true; |
743 } | 744 } |
744 } | 745 } |
745 | 746 |
746 return false; | 747 return false; |
747 } | 748 } |
748 | 749 |
749 bool FullscreenControllerStateTest::ShouldSkipTest(State state, Event event) { | 750 bool FullscreenControllerStateTest::ShouldSkipTest(State state, Event event) { |
750 // Quietly skip metro snap tests when not on windows. | 751 // Quietly skip metro snap tests when not on windows. |
751 #if !defined(OS_WIN) | 752 #if !defined(OS_WIN) |
752 if (state == STATE_METRO_SNAP || | 753 if (state == STATE_METRO_SNAP || |
753 event == METRO_SNAP_TRUE || | 754 event == METRO_SNAP_TRUE || |
754 event == METRO_SNAP_FALSE) { | 755 event == METRO_SNAP_FALSE) { |
755 debugging_log_ << "\nSkipping metro snap test on non-Windows.\n"; | 756 debugging_log_ << "\nSkipping metro snap test on non-Windows.\n"; |
756 return true; | 757 return true; |
757 } | 758 } |
758 #endif | 759 #endif |
759 | 760 |
760 // Quietly skip Mac Lion Fullscreen tests when not on OSX 10.7+. | 761 // Quietly skip Mac Lion Fullscreen tests when not on OSX 10.7+. |
761 if (!IsMacOSLionOrLater()) { | 762 if (!SupportsMacSystemFullscreen()) { |
762 if (state == STATE_BROWSER_FULLSCREEN_WITH_CHROME || | 763 if (state == STATE_BROWSER_FULLSCREEN_WITH_CHROME || |
763 event == TOGGLE_FULLSCREEN_CHROME) { | 764 event == TOGGLE_FULLSCREEN_CHROME) { |
764 debugging_log_ << "\nSkipping Lion Fullscreen test on non-OSX 10.7+.\n"; | 765 debugging_log_ << "\nSkipping Lion Fullscreen test on non-OSX 10.7+.\n"; |
765 return true; | 766 return true; |
766 } | 767 } |
767 } | 768 } |
768 | 769 |
769 // When testing reentrancy there are states the fullscreen controller | 770 // When testing reentrancy there are states the fullscreen controller |
770 // will be unable to remain in, as they will progress due to the | 771 // will be unable to remain in, as they will progress due to the |
771 // reentrant window change call. Skip states that will be instantly | 772 // reentrant window change call. Skip states that will be instantly |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 << std::right << std::setw(2) | 852 << std::right << std::setw(2) |
852 << info.distance | 853 << info.distance |
853 << " }, // " | 854 << " }, // " |
854 << GetStateString(state2) << "\n"; | 855 << GetStateString(state2) << "\n"; |
855 } | 856 } |
856 output << "},\n"; | 857 output << "},\n"; |
857 } | 858 } |
858 output << "};"; | 859 output << "};"; |
859 return output.str(); | 860 return output.str(); |
860 } | 861 } |
OLD | NEW |