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

Side by Side 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: refactor 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h"
6
7 #include "base/macros.h"
8 #include "chrome/browser/android/vr_shell/ui_scene.h"
9 #include "chrome/browser/android/vr_shell/vr_browser_interface.h"
10 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace vr_shell {
14
15 namespace {
16
17 class MockBrowserInterface : public VrBrowserInterface {
18 public:
19 MockBrowserInterface() : weak_ptr_factory_(this) {}
20 ~MockBrowserInterface() override {}
21
22 base::WeakPtr<VrBrowserInterface> GetWeakPtr() {
23 return weak_ptr_factory_.GetWeakPtr();
24 }
25
26 MOCK_METHOD1(OnContentPaused, void(bool));
27
28 private:
29 base::WeakPtrFactory<VrBrowserInterface> weak_ptr_factory_;
30
31 DISALLOW_COPY_AND_ASSIGN(MockBrowserInterface);
32 };
33
34 } // namespace
35
36 class UiSceneManagerTest : public testing::Test {
cjgrant 2017/05/02 18:07:06 This looks awesome now IMO. Thanks!
ymalik 2017/05/02 20:28:40 Acknowledged.
37 public:
38 void SetUp() override {
39 browser_ = base::MakeUnique<MockBrowserInterface>();
40 scene_ = base::MakeUnique<UiScene>();
41 manager_ =
42 base::MakeUnique<UiSceneManager>(browser_->GetWeakPtr(), scene_.get());
43 }
44
45 protected:
46 std::unique_ptr<MockBrowserInterface> browser_;
47 std::unique_ptr<UiScene> scene_;
48 std::unique_ptr<UiSceneManager> manager_;
49 };
50
51 TEST_F(UiSceneManagerTest, AppButtonPressed) {
cjgrant 2017/05/02 18:07:06 "Pressed" sounds like "pressed and held". "Clicke
cjgrant 2017/05/02 18:07:06 I think style prefers verbose test names that desc
ymalik 2017/05/02 20:28:40 Done. Renamed OnAppButtonPressed to OnAppButtonCli
52 EXPECT_CALL(*browser_, OnContentPaused(true)).Times(1);
53 manager_->AppButtonPressed();
cjgrant 2017/05/02 18:07:06 Should you check that the scene is also now report
cjgrant 2017/05/02 18:07:06 Why not also check that another click unpaused con
ymalik 2017/05/02 20:28:40 Totally!
54 }
55
56 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698