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

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

Issue 2833773005: Pause drawing webvr when the App button is pressed (Closed)
Patch Set: make UiBrowserInterface a raw ptr Created 3 years, 8 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..9e22f93f03717ea8991ab9ce070977b81c4e63ae
--- /dev/null
+++ b/chrome/browser/android/vr_shell/ui_scene_manager_unittest.cc
@@ -0,0 +1,62 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/vr_shell/ui_scene_manager.h"
+
+#include "base/macros.h"
+#include "chrome/browser/android/vr_shell/ui_scene.h"
+#include "chrome/browser/android/vr_shell/vr_browser_interface.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using testing::InSequence;
+
+namespace vr_shell {
+
+namespace {
+
+class MockBrowserInterface : public VrBrowserInterface {
+ public:
+ MockBrowserInterface() {}
+ ~MockBrowserInterface() override {}
+
+ MOCK_METHOD1(OnContentPaused, void(bool));
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockBrowserInterface);
+};
+
+} // namespace
+
+class UiSceneManagerTest : public testing::Test {
+ public:
+ void SetUp() override {
+ browser_ = base::MakeUnique<MockBrowserInterface>();
+ scene_ = base::MakeUnique<UiScene>();
+ manager_ = base::MakeUnique<UiSceneManager>(browser_.get(), scene_.get());
+ }
+
+ protected:
+ std::unique_ptr<MockBrowserInterface> browser_;
+ std::unique_ptr<UiScene> scene_;
+ std::unique_ptr<UiSceneManager> manager_;
+};
+
+TEST_F(UiSceneManagerTest, ContentPausesOnAppButtonClick) {
+ InSequence s;
+
+ EXPECT_TRUE(scene_->GetWebVrRenderingEnabled());
+
+ // Clicking app button once should pause content rendering.
+ EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1);
+ manager_->OnAppButtonClicked();
+ EXPECT_FALSE(scene_->GetWebVrRenderingEnabled());
+
+ // Clicking it again should resume content rendering.
+ EXPECT_CALL(*browser_, OnContentPaused(false)).Times(1);
+ manager_->OnAppButtonClicked();
+ EXPECT_TRUE(scene_->GetWebVrRenderingEnabled());
+}
+
+} // namespace vr_shell
« no previous file with comments | « chrome/browser/android/vr_shell/ui_scene_manager.cc ('k') | chrome/browser/android/vr_shell/vr_browser_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698