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

Side by Side Diff: components/arc/kiosk/arc_kiosk_bridge_unittest.cc

Issue 2811303003: arc: Add unit tests for ArcKioskBridge (Closed)
Patch Set: fix comments 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 unified diff | Download patch
« no previous file with comments | « components/arc/BUILD.gn ('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
(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 <memory>
6
7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h"
9 #include "components/arc/arc_bridge_service.h"
10 #include "components/arc/kiosk/arc_kiosk_bridge.h"
11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace {
15
16 class MockArcKioskBridgeDelegate : public arc::ArcKioskBridge::Delegate {
17 public:
18 MockArcKioskBridgeDelegate() = default;
19
20 MOCK_METHOD0(OnMaintenanceSessionCreated, void());
21 MOCK_METHOD0(OnMaintenanceSessionFinished, void());
22 };
23
24 } // namespace
25
26 namespace arc {
27
28 class ArcKioskBridgeTest : public testing::Test {
29 public:
30 ArcKioskBridgeTest()
31 : bridge_service_(base::MakeUnique<ArcBridgeService>()),
32 delegate_(base::MakeUnique<MockArcKioskBridgeDelegate>()),
33 kiosk_bridge_(base::MakeUnique<ArcKioskBridge>(bridge_service_.get(),
34 delegate_.get())) {}
35
36 protected:
37 std::unique_ptr<ArcBridgeService> bridge_service_;
38 std::unique_ptr<MockArcKioskBridgeDelegate> delegate_;
39 std::unique_ptr<ArcKioskBridge> kiosk_bridge_;
40
41 private:
42 DISALLOW_COPY_AND_ASSIGN(ArcKioskBridgeTest);
43 };
44
45 TEST_F(ArcKioskBridgeTest, MaintenanceSessionFinished) {
46 EXPECT_CALL(*delegate_, OnMaintenanceSessionCreated()).Times(1);
47 kiosk_bridge_->OnMaintenanceSessionCreated(1);
48 EXPECT_CALL(*delegate_, OnMaintenanceSessionFinished()).Times(1);
49 kiosk_bridge_->OnMaintenanceSessionFinished(1, true);
50 }
51
52 TEST_F(ArcKioskBridgeTest, MaintenanceSessionNotFinished) {
53 EXPECT_CALL(*delegate_, OnMaintenanceSessionCreated()).Times(1);
54 kiosk_bridge_->OnMaintenanceSessionCreated(1);
55 EXPECT_CALL(*delegate_, OnMaintenanceSessionFinished()).Times(0);
56 kiosk_bridge_->OnMaintenanceSessionFinished(2, true);
57 }
58
59 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698