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

Unified Diff: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc

Issue 2960533002: VR: Add support for time-aware unit tests. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
index 38b82414712b3d60651a222fd83c09b15bff338c..4bfbb4ecfa776b12c7406feba74db4a9f606a570 100644
--- a/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
+++ b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
@@ -6,7 +6,8 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
-#include "base/test/scoped_task_environment.h"
+#include "base/message_loop/message_loop.h"
+#include "base/test/scoped_mock_time_message_loop_task_runner.h"
#include "chrome/browser/android/vr_shell/ui_browser_interface.h"
#include "chrome/browser/android/vr_shell/ui_elements/ui_element.h"
#include "chrome/browser/android/vr_shell/ui_elements/ui_element_debug_id.h"
@@ -102,7 +103,8 @@ class UiSceneManagerTest : public testing::Test {
return true;
}
- base::test::ScopedTaskEnvironment scoped_task_environment_;
+ base::MessageLoop message_loop_;
+ base::ScopedMockTimeMessageLoopTaskRunner task_runner_;
bshe 2017/06/26 15:40:17 optional nit: should we define this in the test th
cjgrant 2017/06/26 16:26:35 Done.
std::unique_ptr<MockBrowserInterface> browser_;
std::unique_ptr<UiScene> scene_;
std::unique_ptr<UiSceneManager> manager_;
@@ -148,6 +150,18 @@ TEST_F(UiSceneManagerTest, WebVrWarningsDoNotShowWhenInitiallyOutsideWebVr) {
EXPECT_TRUE(IsVisible(kWebVrTransientHttpSecurityWarning));
}
+TEST_F(UiSceneManagerTest, WebVrTransientWarningTimesOut) {
+ MakeManager(kNotInCct, kInWebVr);
+
+ EXPECT_TRUE(IsVisible(kWebVrTransientHttpSecurityWarning));
+ // TODO(crbug.com/736558): Fast forwarding appears broken in conjunction with
ymalik 2017/06/26 14:55:21 Nit: Spoke offline, since there's nothing actionab
cjgrant 2017/06/26 16:26:35 Done. And improved the explanation.
+ // restarting timers. Here, we can fast forward by the appropriate time
+ // interval, but in other cases (until the bug is addressed), we could fast
+ // forward until all tasks are addresed.
+ task_runner_->FastForwardBy(base::TimeDelta::FromSeconds(31));
+ EXPECT_FALSE(IsVisible(kWebVrTransientHttpSecurityWarning));
+}
+
TEST_F(UiSceneManagerTest, ToastVisibility) {
// Tests toast not showing when directly entering VR though WebVR
// presentation.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698