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

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

Issue 2004353002: Delete unused code for exclusive access permission prompting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fullscreen-mac-remove-window-controller
Patch Set: Remove changes to content settings UI (spun out to CL 2045163002). Created 4 years, 6 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
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 "chrome/browser/ui/exclusive_access/fullscreen_controller_state_test.h" 5 #include "chrome/browser/ui/exclusive_access/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>
(...skipping 27 matching lines...) Expand all
38 last_notification_received_state_(STATE_NORMAL) { 38 last_notification_received_state_(STATE_NORMAL) {
39 // Human specified state machine data. 39 // Human specified state machine data.
40 // For each state, for each event, define the resulting state. 40 // For each state, for each event, define the resulting state.
41 State transition_table_data[][NUM_EVENTS] = { 41 State transition_table_data[][NUM_EVENTS] = {
42 { // STATE_NORMAL: 42 { // STATE_NORMAL:
43 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event TOGGLE_FULLSCREEN 43 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event TOGGLE_FULLSCREEN
44 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event TOGGLE_FULLSCREEN_CHROME 44 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event TOGGLE_FULLSCREEN_CHROME
45 STATE_TO_TAB_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE 45 STATE_TO_TAB_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE
46 STATE_NORMAL, // Event TAB_FULLSCREEN_FALSE 46 STATE_NORMAL, // Event TAB_FULLSCREEN_FALSE
47 STATE_NORMAL, // Event BUBBLE_EXIT_LINK 47 STATE_NORMAL, // Event BUBBLE_EXIT_LINK
48 STATE_NORMAL, // Event BUBBLE_ALLOW
49 STATE_NORMAL, // Event BUBBLE_DENY
50 STATE_NORMAL, // Event WINDOW_CHANGE 48 STATE_NORMAL, // Event WINDOW_CHANGE
51 }, 49 },
52 { // STATE_BROWSER_FULLSCREEN_NO_CHROME: 50 { // STATE_BROWSER_FULLSCREEN_NO_CHROME:
53 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN 51 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN
54 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME 52 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME
55 STATE_TAB_BROWSER_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE 53 STATE_TAB_BROWSER_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE
56 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_FALSE 54 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_FALSE
57 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK 55 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK
58 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_ALLOW
59 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_DENY
60 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event WINDOW_CHANGE 56 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event WINDOW_CHANGE
61 }, 57 },
62 { // STATE_BROWSER_FULLSCREEN_WITH_CHROME: 58 { // STATE_BROWSER_FULLSCREEN_WITH_CHROME:
63 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN 59 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN
64 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME 60 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME
65 STATE_TAB_BROWSER_FULLSCREEN_CHROME, // Event TAB_FULLSCREEN_TRUE 61 STATE_TAB_BROWSER_FULLSCREEN_CHROME, // Event TAB_FULLSCREEN_TRUE
66 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event TAB_FULLSCREEN_FALSE 62 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event TAB_FULLSCREEN_FALSE
67 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK 63 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK
68 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event BUBBLE_ALLOW
69 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event BUBBLE_DENY
70 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event WINDOW_CHANGE 64 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event WINDOW_CHANGE
71 }, 65 },
72 { // STATE_TAB_FULLSCREEN: 66 { // STATE_TAB_FULLSCREEN:
73 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN 67 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN
74 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME 68 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME
75 STATE_TAB_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE 69 STATE_TAB_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE
76 STATE_TO_NORMAL, // Event TAB_FULLSCREEN_FALSE 70 STATE_TO_NORMAL, // Event TAB_FULLSCREEN_FALSE
77 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK 71 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK
78 STATE_TAB_FULLSCREEN, // Event BUBBLE_ALLOW
79 STATE_TO_NORMAL, // Event BUBBLE_DENY
80 STATE_TAB_FULLSCREEN, // Event WINDOW_CHANGE 72 STATE_TAB_FULLSCREEN, // Event WINDOW_CHANGE
81 }, 73 },
82 { // STATE_TAB_BROWSER_FULLSCREEN: 74 { // STATE_TAB_BROWSER_FULLSCREEN:
83 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN 75 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN
84 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME 76 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME
85 STATE_TAB_BROWSER_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE 77 STATE_TAB_BROWSER_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE
86 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_FALSE 78 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_FALSE
87 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_EXIT_LINK 79 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_EXIT_LINK
88 STATE_TAB_BROWSER_FULLSCREEN, // Event BUBBLE_ALLOW
89 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_DENY
90 STATE_TAB_BROWSER_FULLSCREEN, // Event WINDOW_CHANGE 80 STATE_TAB_BROWSER_FULLSCREEN, // Event WINDOW_CHANGE
91 }, 81 },
92 { // STATE_TAB_BROWSER_FULLSCREEN_CHROME: 82 { // STATE_TAB_BROWSER_FULLSCREEN_CHROME:
93 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN 83 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN
94 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME 84 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME
95 STATE_TAB_BROWSER_FULLSCREEN_CHROME, // Event TAB_FULLSCREEN_TRUE 85 STATE_TAB_BROWSER_FULLSCREEN_CHROME, // Event TAB_FULLSCREEN_TRUE
96 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event TAB_FULLSCREEN_FALSE 86 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event TAB_FULLSCREEN_FALSE
97 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event BUBBLE_EXIT_LINK 87 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event BUBBLE_EXIT_LINK
98 STATE_TAB_BROWSER_FULLSCREEN_CHROME, // Event BUBBLE_ALLOW
99 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event BUBBLE_DENY
100 STATE_TAB_BROWSER_FULLSCREEN_CHROME, // Event WINDOW_CHANGE 88 STATE_TAB_BROWSER_FULLSCREEN_CHROME, // Event WINDOW_CHANGE
101 }, 89 },
102 { // STATE_TO_NORMAL: 90 { // STATE_TO_NORMAL:
103 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event TOGGLE_FULLSCREEN 91 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event TOGGLE_FULLSCREEN
104 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event TOGGLE_FULLSCREEN_CHROME 92 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event TOGGLE_FULLSCREEN_CHROME
105 // TODO(scheib) Should be a route back to TAB. http://crbug.com/154196 93 // TODO(scheib) Should be a route back to TAB. http://crbug.com/154196
106 STATE_TO_NORMAL, // Event TAB_FULLSCREEN_TRUE 94 STATE_TO_NORMAL, // Event TAB_FULLSCREEN_TRUE
107 STATE_TO_NORMAL, // Event TAB_FULLSCREEN_FALSE 95 STATE_TO_NORMAL, // Event TAB_FULLSCREEN_FALSE
108 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK 96 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK
109 STATE_TO_NORMAL, // Event BUBBLE_ALLOW
110 STATE_TO_NORMAL, // Event BUBBLE_DENY
111 STATE_NORMAL, // Event WINDOW_CHANGE 97 STATE_NORMAL, // Event WINDOW_CHANGE
112 }, 98 },
113 { // STATE_TO_BROWSER_FULLSCREEN_NO_CHROME: 99 { // STATE_TO_BROWSER_FULLSCREEN_NO_CHROME:
114 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN 100 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN
115 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME 101 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME
116 // TODO(scheib) Should be a route to TAB_BROWSER http://crbug.com/154196 102 // TODO(scheib) Should be a route to TAB_BROWSER http://crbug.com/154196
117 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_TRUE 103 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_TRUE
118 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_FALSE 104 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_FALSE
119 #if defined(OS_MACOSX) 105 #if defined(OS_MACOSX)
120 // Mac window reports fullscreen immediately and an exit triggers exit. 106 // Mac window reports fullscreen immediately and an exit triggers exit.
121 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK 107 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK
122 #else 108 #else
123 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_EXIT_LINK 109 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_EXIT_LINK
124 #endif 110 #endif
125 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_ALLOW
126 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event BUBBLE_DENY
127 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event WINDOW_CHANGE 111 STATE_BROWSER_FULLSCREEN_NO_CHROME, // Event WINDOW_CHANGE
128 }, 112 },
129 { // STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME: 113 { // STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME:
130 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN 114 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN
131 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME 115 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME
132 // TODO(scheib) Should be a route to TAB_BROWSER http://crbug.com/154196 116 // TODO(scheib) Should be a route to TAB_BROWSER http://crbug.com/154196
133 STATE_TAB_BROWSER_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE 117 STATE_TAB_BROWSER_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE
134 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event TAB_FULLSCREEN_FALSE 118 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event TAB_FULLSCREEN_FALSE
135 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK 119 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK
136 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event BUBBLE_ALLOW
137 STATE_TO_BROWSER_FULLSCREEN_WITH_CHROME,// Event BUBBLE_DENY
138 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event WINDOW_CHANGE 120 STATE_BROWSER_FULLSCREEN_WITH_CHROME, // Event WINDOW_CHANGE
139 }, 121 },
140 { // STATE_TO_TAB_FULLSCREEN: 122 { // STATE_TO_TAB_FULLSCREEN:
141 // TODO(scheib) Should be a route to TAB_BROWSER http://crbug.com/154196 123 // TODO(scheib) Should be a route to TAB_BROWSER http://crbug.com/154196
142 STATE_TO_TAB_FULLSCREEN, // Event TOGGLE_FULLSCREEN 124 STATE_TO_TAB_FULLSCREEN, // Event TOGGLE_FULLSCREEN
143 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME 125 STATE_TO_NORMAL, // Event TOGGLE_FULLSCREEN_CHROME
144 STATE_TO_TAB_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE 126 STATE_TO_TAB_FULLSCREEN, // Event TAB_FULLSCREEN_TRUE
145 #if defined(OS_MACOSX) 127 #if defined(OS_MACOSX)
146 // Mac runs as expected due to a forced NotifyTabOfExitIfNecessary(); 128 // Mac runs as expected due to a forced NotifyTabOfExitIfNecessary();
147 STATE_TO_NORMAL, // Event TAB_FULLSCREEN_FALSE 129 STATE_TO_NORMAL, // Event TAB_FULLSCREEN_FALSE
148 #else 130 #else
149 // TODO(scheib) Should be a route back to NORMAL. http://crbug.com/154196 131 // TODO(scheib) Should be a route back to NORMAL. http://crbug.com/154196
150 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_FALSE 132 STATE_TO_BROWSER_FULLSCREEN_NO_CHROME, // Event TAB_FULLSCREEN_FALSE
151 #endif 133 #endif
152 #if defined(OS_MACOSX) 134 #if defined(OS_MACOSX)
153 // Mac window reports fullscreen immediately and an exit triggers exit. 135 // Mac window reports fullscreen immediately and an exit triggers exit.
154 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK 136 STATE_TO_NORMAL, // Event BUBBLE_EXIT_LINK
155 #else 137 #else
156 STATE_TO_TAB_FULLSCREEN, // Event BUBBLE_EXIT_LINK 138 STATE_TO_TAB_FULLSCREEN, // Event BUBBLE_EXIT_LINK
157 #endif 139 #endif
158 STATE_TO_TAB_FULLSCREEN, // Event BUBBLE_ALLOW
159 #if defined(OS_MACOSX)
160 // Mac window reports fullscreen immediately and an exit triggers exit.
161 STATE_TO_NORMAL, // Event BUBBLE_DENY
162 #else
163 STATE_TO_TAB_FULLSCREEN, // Event BUBBLE_DENY
164 #endif
165 STATE_TAB_FULLSCREEN, // Event WINDOW_CHANGE 140 STATE_TAB_FULLSCREEN, // Event WINDOW_CHANGE
166 }, 141 },
167 }; 142 };
168 static_assert(sizeof(transition_table_data) == sizeof(transition_table_), 143 static_assert(sizeof(transition_table_data) == sizeof(transition_table_),
169 "transition_table has unexpected size"); 144 "transition_table has unexpected size");
170 memcpy(transition_table_, transition_table_data, 145 memcpy(transition_table_, transition_table_data,
171 sizeof(transition_table_data)); 146 sizeof(transition_table_data));
172 147
173 // Verify that transition_table_ has been completely defined. 148 // Verify that transition_table_ has been completely defined.
174 for (int source = 0; source < NUM_STATES; ++source) { 149 for (int source = 0; source < NUM_STATES; ++source) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 192 }
218 193
219 // static 194 // static
220 const char* FullscreenControllerStateTest::GetEventString(Event event) { 195 const char* FullscreenControllerStateTest::GetEventString(Event event) {
221 switch (event) { 196 switch (event) {
222 ENUM_TO_STRING(TOGGLE_FULLSCREEN); 197 ENUM_TO_STRING(TOGGLE_FULLSCREEN);
223 ENUM_TO_STRING(TOGGLE_FULLSCREEN_CHROME); 198 ENUM_TO_STRING(TOGGLE_FULLSCREEN_CHROME);
224 ENUM_TO_STRING(TAB_FULLSCREEN_TRUE); 199 ENUM_TO_STRING(TAB_FULLSCREEN_TRUE);
225 ENUM_TO_STRING(TAB_FULLSCREEN_FALSE); 200 ENUM_TO_STRING(TAB_FULLSCREEN_FALSE);
226 ENUM_TO_STRING(BUBBLE_EXIT_LINK); 201 ENUM_TO_STRING(BUBBLE_EXIT_LINK);
227 ENUM_TO_STRING(BUBBLE_ALLOW);
228 ENUM_TO_STRING(BUBBLE_DENY);
229 ENUM_TO_STRING(WINDOW_CHANGE); 202 ENUM_TO_STRING(WINDOW_CHANGE);
230 ENUM_TO_STRING(EVENT_INVALID); 203 ENUM_TO_STRING(EVENT_INVALID);
231 default: 204 default:
232 NOTREACHED() << "No string for event " << event; 205 NOTREACHED() << "No string for event " << event;
233 return "Event-Unknown"; 206 return "Event-Unknown";
234 } 207 }
235 } 208 }
236 209
237 // static 210 // static
238 bool FullscreenControllerStateTest::IsWindowFullscreenStateChangedReentrant() { 211 bool FullscreenControllerStateTest::IsWindowFullscreenStateChangedReentrant() {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // evoke a state change in the browser window. 334 // evoke a state change in the browser window.
362 if (active_tab->GetCapturerCount() > 0) 335 if (active_tab->GetCapturerCount() > 0)
363 state_ = source_state; 336 state_ = source_state;
364 break; 337 break;
365 } 338 }
366 339
367 case BUBBLE_EXIT_LINK: 340 case BUBBLE_EXIT_LINK:
368 GetFullscreenController()->ExitExclusiveAccessToPreviousState(); 341 GetFullscreenController()->ExitExclusiveAccessToPreviousState();
369 break; 342 break;
370 343
371 case BUBBLE_ALLOW:
372 GetBrowser()
373 ->exclusive_access_manager()
374 ->OnAcceptExclusiveAccessPermission();
375 break;
376
377 case BUBBLE_DENY:
378 GetBrowser()
379 ->exclusive_access_manager()
380 ->OnDenyExclusiveAccessPermission();
381 break;
382
383 case WINDOW_CHANGE: 344 case WINDOW_CHANGE:
384 ChangeWindowFullscreenState(); 345 ChangeWindowFullscreenState();
385 break; 346 break;
386 347
387 default: 348 default:
388 NOTREACHED() << "InvokeEvent needs a handler for event " 349 NOTREACHED() << "InvokeEvent needs a handler for event "
389 << GetEventString(event) << GetAndClearDebugLog(); 350 << GetEventString(event) << GetAndClearDebugLog();
390 return false; 351 return false;
391 } 352 }
392 353
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 << std::right << std::setw(2) 677 << std::right << std::setw(2)
717 << info.distance 678 << info.distance
718 << " }, // " 679 << " }, // "
719 << GetStateString(state2) << "\n"; 680 << GetStateString(state2) << "\n";
720 } 681 }
721 output << "},\n"; 682 output << "},\n";
722 } 683 }
723 output << "};"; 684 output << "};";
724 return output.str(); 685 return output.str();
725 } 686 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698