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

Side by Side Diff: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc

Issue 2955023002: VR: Factor transient timing out of UiSceneManager. (Closed)
Patch Set: Get rid of EndVisibility(). Created 3 years, 5 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/android/vr_shell/ui_scene_manager.h" 5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/test/scoped_mock_time_message_loop_task_runner.h" 10 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Note: Fast-forwarding appears broken in conjunction with restarting timers. 158 // Note: Fast-forwarding appears broken in conjunction with restarting timers.
159 // In this test, we can fast-forward by the appropriate time interval, but in 159 // In this test, we can fast-forward by the appropriate time interval, but in
160 // other cases (until the bug is addressed), we could work around the problem 160 // other cases (until the bug is addressed), we could work around the problem
161 // by using FastForwardUntilNoTasksRemain() instead. 161 // by using FastForwardUntilNoTasksRemain() instead.
162 // See http://crbug.com/736558. 162 // See http://crbug.com/736558.
163 task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(31)); 163 task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(31));
164 EXPECT_FALSE(IsVisible(kWebVrTransientHttpSecurityWarning)); 164 EXPECT_FALSE(IsVisible(kWebVrTransientHttpSecurityWarning));
165 } 165 }
166 166
167 TEST_F(UiSceneManagerTest, ToastVisibility) { 167 TEST_F(UiSceneManagerTest, ToastVisibility) {
168 base::ScopedMockTimeMessageLoopTaskRunner task_runner_;
bshe 2017/06/27 14:57:09 Do you need this? Or do you want to add time sensi
cjgrant 2017/06/28 19:00:55 Done. I made a separate test to verify transience
169
168 // Tests toast not showing when directly entering VR though WebVR 170 // Tests toast not showing when directly entering VR though WebVR
169 // presentation. 171 // presentation.
170 MakeManager(kNotInCct, kInWebVr); 172 MakeManager(kNotInCct, kInWebVr);
171 EXPECT_FALSE(IsVisible(kPresentationToast)); 173 EXPECT_FALSE(IsVisible(kPresentationToast));
172 174
173 MakeManager(kNotInCct, kNotInWebVr); 175 MakeManager(kNotInCct, kNotInWebVr);
174 EXPECT_FALSE(IsVisible(kPresentationToast)); 176 EXPECT_FALSE(IsVisible(kPresentationToast));
175 177
176 manager_->SetFullscreen(true); 178 manager_->SetFullscreen(true);
177 EXPECT_TRUE(IsVisible(kPresentationToast)); 179 EXPECT_TRUE(IsVisible(kPresentationToast));
178 180
179 manager_->SetWebVrMode(true, false, true); 181 manager_->SetWebVrMode(true, false, true);
180 EXPECT_TRUE(IsVisible(kPresentationToast)); 182 EXPECT_TRUE(IsVisible(kPresentationToast));
181 183
182 manager_->SetWebVrMode(false, false, false); 184 manager_->SetWebVrMode(false, false, false);
183 EXPECT_FALSE(IsVisible(kPresentationToast)); 185 EXPECT_FALSE(IsVisible(kPresentationToast));
184 186
185 manager_->SetFullscreen(false); 187 manager_->SetFullscreen(false);
186 EXPECT_FALSE(IsVisible(kPresentationToast)); 188 EXPECT_FALSE(IsVisible(kPresentationToast));
187 189
188 manager_->SetWebVrMode(true, false, false); 190 manager_->SetWebVrMode(true, false, false);
189 EXPECT_FALSE(IsVisible(kPresentationToast)); 191 EXPECT_FALSE(IsVisible(kPresentationToast));
190 192
191 manager_->SetWebVrMode(false, false, true); 193 manager_->SetWebVrMode(false, false, true);
192 EXPECT_TRUE(IsVisible(kPresentationToast)); 194 EXPECT_FALSE(IsVisible(kPresentationToast));
193 } 195 }
194 196
195 TEST_F(UiSceneManagerTest, CloseButtonVisibleInCctFullscreen) { 197 TEST_F(UiSceneManagerTest, CloseButtonVisibleInCctFullscreen) {
196 // Button should be visible in cct. 198 // Button should be visible in cct.
197 MakeManager(kInCct, kNotInWebVr); 199 MakeManager(kInCct, kNotInWebVr);
198 EXPECT_TRUE(IsVisible(kCloseButton)); 200 EXPECT_TRUE(IsVisible(kCloseButton));
199 201
200 // Button should not be visible when not in cct or fullscreen. 202 // Button should not be visible when not in cct or fullscreen.
201 MakeManager(kNotInCct, kNotInWebVr); 203 MakeManager(kNotInCct, kNotInWebVr);
202 EXPECT_FALSE(IsVisible(kCloseButton)); 204 EXPECT_FALSE(IsVisible(kCloseButton));
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 423
422 // Ensure they can be turned off. 424 // Ensure they can be turned off.
423 manager_->SetAudioCapturingIndicator(false); 425 manager_->SetAudioCapturingIndicator(false);
424 manager_->SetVideoCapturingIndicator(false); 426 manager_->SetVideoCapturingIndicator(false);
425 manager_->SetScreenCapturingIndicator(false); 427 manager_->SetScreenCapturingIndicator(false);
426 manager_->SetLocationAccessIndicator(false); 428 manager_->SetLocationAccessIndicator(false);
427 EXPECT_TRUE(VerifyVisibility(indicators, false)); 429 EXPECT_TRUE(VerifyVisibility(indicators, false));
428 } 430 }
429 431
430 } // namespace vr_shell 432 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698