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

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

Issue 2873043002: VrShell: Add test for fullscreen transitions. (Closed)
Patch Set: oops, forgot to rebase Created 3 years, 7 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 | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/android/vr_shell/ui_elements/ui_element.h"
8 #include "chrome/browser/android/vr_shell/ui_scene.h" 9 #include "chrome/browser/android/vr_shell/ui_scene.h"
9 #include "chrome/browser/android/vr_shell/vr_browser_interface.h" 10 #include "chrome/browser/android/vr_shell/vr_browser_interface.h"
10 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 using testing::InSequence; 14 using testing::InSequence;
14 15
15 namespace vr_shell { 16 namespace vr_shell {
16 17
17 namespace { 18 namespace {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1); 72 EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1);
72 manager_->OnAppButtonClicked(); 73 manager_->OnAppButtonClicked();
73 EXPECT_FALSE(scene_->GetWebVrRenderingEnabled()); 74 EXPECT_FALSE(scene_->GetWebVrRenderingEnabled());
74 75
75 // Clicking it again should resume content rendering. 76 // Clicking it again should resume content rendering.
76 EXPECT_CALL(*browser_, OnContentPaused(false)).Times(1); 77 EXPECT_CALL(*browser_, OnContentPaused(false)).Times(1);
77 manager_->OnAppButtonClicked(); 78 manager_->OnAppButtonClicked();
78 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled()); 79 EXPECT_TRUE(scene_->GetWebVrRenderingEnabled());
79 } 80 }
80 81
82 TEST_F(UiSceneManagerTest, UiUpdatesForFullscreen) {
83 InSequence s;
84 // Set mode to not WebVR, everything should be visible.
85 manager_->SetWebVRMode(false);
86
87 // Hold onto the background color to make sure it changes.
88 vr::Colorf initialBackground = scene_->GetBackgroundColor();
89
90 for (UiElement* element : manager_->browser_ui_elements_) {
91 EXPECT_TRUE(element->visible());
92 }
93
94 manager_->SetFullscreen(true);
95
96 // All elements should be hidden except for main content.
97 for (UiElement* element : manager_->browser_ui_elements_) {
98 if (element == manager_->main_content_) {
99 EXPECT_TRUE(element->visible());
100 continue;
101 }
102 EXPECT_FALSE(element->visible());
103 }
104 // Make sure background has changed for fullscreen.
105 // TODO(amp): Check more than just the red value.
bsheedy 2017/05/09 21:27:09 This seems like a simple thing to add in this CL -
amp 2017/05/09 21:36:24 The reason for the TODO is that I really just want
amp 2017/05/09 22:47:37 Decided to go ahead and just add it. One thing is
cjgrant 2017/05/10 14:08:36 I feel your pain on this one. :) Wrapper functions
amp 2017/05/10 16:05:55 I'll leave it as is for now since we only care tha
106 EXPECT_NE(initialBackground.r, scene_->GetBackgroundColor().r);
107
108 manager_->SetFullscreen(false);
109
110 // Everything should return to original state after leaving fullscreen.
111 for (UiElement* element : manager_->browser_ui_elements_) {
112 EXPECT_TRUE(element->visible());
113 }
114 // TODO(amp): Check more than just the red value.
bsheedy 2017/05/09 21:27:09 Ditto.
115 EXPECT_EQ(initialBackground.r, scene_->GetBackgroundColor().r);
116 }
117
81 } // namespace vr_shell 118 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698