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

Side by Side Diff: chrome/browser/ui/exclusive_access/fullscreen_controller_interactive_browsertest.cc

Issue 1709803004: Add ViewsSimplifiedFullscreenUI to the fieldtrial testing config on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Paramaterize Created 4 years, 10 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
« no previous file with comments | « no previous file | testing/variations/fieldtrial_testing_config_mac.json » ('j') | 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 "base/command_line.h"
5 #include "build/build_config.h" 6 #include "build/build_config.h"
6 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
7 #include "chrome/browser/fullscreen.h" 8 #include "chrome/browser/fullscreen.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 11 #include "chrome/browser/ui/browser_commands.h"
11 #include "chrome/browser/ui/browser_window.h" 12 #include "chrome/browser/ui/browser_window.h"
12 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" 13 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
13 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" 14 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 15 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/test/base/interactive_test_utils.h" 16 #include "chrome/test/base/interactive_test_utils.h"
16 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
17 #include "components/content_settings/core/browser/host_content_settings_map.h" 18 #include "components/content_settings/core/browser/host_content_settings_map.h"
18 #include "content/public/browser/render_view_host.h" 19 #include "content/public/browser/render_view_host.h"
19 #include "content/public/browser/render_widget_host.h" 20 #include "content/public/browser/render_widget_host.h"
20 #include "content/public/browser/render_widget_host_view.h" 21 #include "content/public/browser/render_widget_host_view.h"
21 #include "content/public/browser/web_contents.h" 22 #include "content/public/browser/web_contents.h"
23 #include "content/public/common/content_switches.h"
22 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
23 #include "net/test/embedded_test_server/embedded_test_server.h" 25 #include "net/test/embedded_test_server/embedded_test_server.h"
24 26
25 using url::kAboutBlankURL; 27 using url::kAboutBlankURL;
26 using content::WebContents; 28 using content::WebContents;
27 using ui::PAGE_TRANSITION_TYPED; 29 using ui::PAGE_TRANSITION_TYPED;
28 30
29 namespace { 31 namespace {
30 32
31 const base::FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("/simple.html"); 33 const base::FilePath::CharType* kSimpleFile = FILE_PATH_LITERAL("/simple.html");
(...skipping 29 matching lines...) Expand all
61 return browser()->IsMouseLocked(); 63 return browser()->IsMouseLocked();
62 } 64 }
63 65
64 void TestFullscreenMouseLockContentSettings(); 66 void TestFullscreenMouseLockContentSettings();
65 67
66 private: 68 private:
67 void ToggleTabFullscreen_Internal(bool enter_fullscreen, 69 void ToggleTabFullscreen_Internal(bool enter_fullscreen,
68 bool retry_until_success); 70 bool retry_until_success);
69 }; 71 };
70 72
73 // Allow the test harness to pick the non-simplified fullscreen UI, which
74 // prompts with an interactive dialog rather than just notifying the user how to
75 // exit fullscreen. TODO(tapted): Remove this when "simplified" is the only way.
76 enum TestType {
77 TEST_TYPE_START,
78 PROMPTING = TEST_TYPE_START,
79 SIMPLIFIED,
80 TEST_TYPE_END,
81 };
82
83 class ParamaterizedFullscreenControllerInteractiveTest
84 : public FullscreenControllerInteractiveTest,
85 public ::testing::WithParamInterface<int> {
86 public:
87 ParamaterizedFullscreenControllerInteractiveTest() {}
88
89 // content::BrowserTestBase:
90 void SetUpCommandLine(base::CommandLine* command_line) override {
91 switch (GetParam()) {
92 case PROMPTING:
93 command_line->AppendSwitchASCII(
94 switches::kDisableFeatures,
95 ExclusiveAccessManager::kSimplifiedUIFeature.name);
96 break;
97 case SIMPLIFIED:
98 command_line->AppendSwitchASCII(
99 switches::kEnableFeatures,
100 ExclusiveAccessManager::kSimplifiedUIFeature.name);
101 break;
102 default:
103 NOTREACHED();
104 }
105 }
106
107 // Whether the test should be prompting the user (i.e. non-simplified UI).
108 bool ShouldPrompt() { return GetParam() == PROMPTING; }
109
110 private:
111 DISALLOW_COPY_AND_ASSIGN(ParamaterizedFullscreenControllerInteractiveTest);
112 };
Ilya Sherman 2016/02/24 01:31:19 I'm not sure that any of this is necessary. I thi
113
71 void FullscreenControllerInteractiveTest::ToggleTabFullscreen( 114 void FullscreenControllerInteractiveTest::ToggleTabFullscreen(
72 bool enter_fullscreen) { 115 bool enter_fullscreen) {
73 ToggleTabFullscreen_Internal(enter_fullscreen, true); 116 ToggleTabFullscreen_Internal(enter_fullscreen, true);
74 } 117 }
75 118
76 // |ToggleTabFullscreen| should not need to tolerate the transition failing. 119 // |ToggleTabFullscreen| should not need to tolerate the transition failing.
77 // Most fullscreen tests run sharded in fullscreen_controller_browsertest.cc 120 // Most fullscreen tests run sharded in fullscreen_controller_browsertest.cc
78 // and some flakiness has occurred when calling |ToggleTabFullscreen|, so that 121 // and some flakiness has occurred when calling |ToggleTabFullscreen|, so that
79 // method has been made robust by retrying if the transition fails. 122 // method has been made robust by retrying if the transition fails.
80 // The root cause of that flakiness should still be tracked down, see 123 // The root cause of that flakiness should still be tracked down, see
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // Flaky on Windows, Linux, CrOS: http://crbug.com/159000 713 // Flaky on Windows, Linux, CrOS: http://crbug.com/159000
671 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS) 714 #if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_CHROMEOS)
672 #define MAYBE_MouseLockSilentAfterTargetUnlock \ 715 #define MAYBE_MouseLockSilentAfterTargetUnlock \
673 DISABLED_MouseLockSilentAfterTargetUnlock 716 DISABLED_MouseLockSilentAfterTargetUnlock
674 #else 717 #else
675 #define MAYBE_MouseLockSilentAfterTargetUnlock MouseLockSilentAfterTargetUnlock 718 #define MAYBE_MouseLockSilentAfterTargetUnlock MouseLockSilentAfterTargetUnlock
676 #endif 719 #endif
677 720
678 // Tests mouse lock can be exited and re-entered by an application silently 721 // Tests mouse lock can be exited and re-entered by an application silently
679 // with no UI distraction for users. 722 // with no UI distraction for users.
680 IN_PROC_BROWSER_TEST_F(FullscreenControllerInteractiveTest, 723 IN_PROC_BROWSER_TEST_P(ParamaterizedFullscreenControllerInteractiveTest,
681 MAYBE_MouseLockSilentAfterTargetUnlock) { 724 MAYBE_MouseLockSilentAfterTargetUnlock) {
682 ASSERT_TRUE(embedded_test_server()->Start()); 725 ASSERT_TRUE(embedded_test_server()->Start());
683 ui_test_utils::NavigateToURL( 726 ui_test_utils::NavigateToURL(
684 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML)); 727 browser(), embedded_test_server()->GetURL(kFullscreenMouseLockHTML));
685 728
686 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); 729 ASSERT_FALSE(IsFullscreenBubbleDisplayed());
687 730
688 // Lock the mouse with a user gesture. 731 // Lock the mouse with a user gesture.
689 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( 732 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
690 browser(), ui::VKEY_1, false, false, false, false, 733 browser(), ui::VKEY_1, false, false, false, false,
691 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, 734 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
692 content::NotificationService::AllSources())); 735 content::NotificationService::AllSources()));
693 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); 736 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
694 ASSERT_TRUE(IsMouseLockPermissionRequested()); 737 if (ShouldPrompt()) {
695 ASSERT_FALSE(IsMouseLocked()); 738 ASSERT_TRUE(IsMouseLockPermissionRequested());
739 ASSERT_FALSE(IsMouseLocked());
696 740
697 // Accept mouse lock. 741 // Accept mouse lock.
698 AcceptCurrentFullscreenOrMouseLockRequest(); 742 AcceptCurrentFullscreenOrMouseLockRequest();
743 }
699 ASSERT_TRUE(IsMouseLocked()); 744 ASSERT_TRUE(IsMouseLocked());
700 ASSERT_TRUE(IsFullscreenBubbleDisplayed()); 745 ASSERT_TRUE(IsFullscreenBubbleDisplayed());
701 746
702 // Unlock the mouse from target, make sure it's unlocked. 747 // Unlock the mouse from target, make sure it's unlocked.
703 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( 748 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait(
704 browser(), ui::VKEY_U, false, false, false, false, 749 browser(), ui::VKEY_U, false, false, false, false,
705 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED, 750 chrome::NOTIFICATION_MOUSE_LOCK_CHANGED,
706 content::NotificationService::AllSources())); 751 content::NotificationService::AllSources()));
707 ASSERT_FALSE(IsMouseLocked()); 752 ASSERT_FALSE(IsMouseLocked());
708 ASSERT_FALSE(IsFullscreenBubbleDisplayed()); 753 ASSERT_FALSE(IsFullscreenBubbleDisplayed());
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 1001
957 GURL url = embedded_test_server()->GetURL("/simple.html"); 1002 GURL url = embedded_test_server()->GetURL("/simple.html");
958 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED); 1003 AddTabAtIndex(0, url, PAGE_TRANSITION_TYPED);
959 1004
960 // Validate that going fullscreen for a URL defaults to asking permision. 1005 // Validate that going fullscreen for a URL defaults to asking permision.
961 ASSERT_FALSE(IsFullscreenPermissionRequested()); 1006 ASSERT_FALSE(IsFullscreenPermissionRequested());
962 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true)); 1007 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(true));
963 ASSERT_TRUE(IsFullscreenPermissionRequested()); 1008 ASSERT_TRUE(IsFullscreenPermissionRequested());
964 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false)); 1009 ASSERT_NO_FATAL_FAILURE(ToggleTabFullscreenNoRetries(false));
965 } 1010 }
1011
1012 INSTANTIATE_TEST_CASE_P(
1013 ParamaterizedFullscreenControllerInteractiveTestInstance,
1014 ParamaterizedFullscreenControllerInteractiveTest,
1015 ::testing::Range<int>(TEST_TYPE_START, TEST_TYPE_END));
OLDNEW
« no previous file with comments | « no previous file | testing/variations/fieldtrial_testing_config_mac.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698