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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/kiosk/arc_kiosk_bridge_unittest.cc
diff --git a/components/arc/kiosk/arc_kiosk_bridge_unittest.cc b/components/arc/kiosk/arc_kiosk_bridge_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b2243f7ca37f844e31555141cf68aa70d206bd66
--- /dev/null
+++ b/components/arc/kiosk/arc_kiosk_bridge_unittest.cc
@@ -0,0 +1,59 @@
+// 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 <memory>
+
+#include "base/macros.h"
+#include "base/memory/ptr_util.h"
+#include "components/arc/arc_bridge_service.h"
+#include "components/arc/kiosk/arc_kiosk_bridge.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+
+class MockArcKioskBridgeDelegate : public arc::ArcKioskBridge::Delegate {
+ public:
+ MockArcKioskBridgeDelegate() = default;
+
+ MOCK_METHOD0(OnMaintenanceSessionCreated, void());
+ MOCK_METHOD0(OnMaintenanceSessionFinished, void());
+};
+
+} // namespace
+
+namespace arc {
+
+class ArcKioskBridgeTest : public testing::Test {
+ public:
+ ArcKioskBridgeTest()
+ : bridge_service_(base::MakeUnique<ArcBridgeService>()),
+ delegate_(base::MakeUnique<MockArcKioskBridgeDelegate>()),
+ kiosk_bridge_(base::MakeUnique<ArcKioskBridge>(bridge_service_.get(),
+ delegate_.get())) {}
+
+ protected:
+ std::unique_ptr<ArcBridgeService> bridge_service_;
+ std::unique_ptr<MockArcKioskBridgeDelegate> delegate_;
+ std::unique_ptr<ArcKioskBridge> kiosk_bridge_;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ArcKioskBridgeTest);
+};
+
+TEST_F(ArcKioskBridgeTest, MaintenanceSessionFinished) {
+ EXPECT_CALL(*delegate_, OnMaintenanceSessionCreated()).Times(1);
+ kiosk_bridge_->OnMaintenanceSessionCreated(1);
+ EXPECT_CALL(*delegate_, OnMaintenanceSessionFinished()).Times(1);
+ kiosk_bridge_->OnMaintenanceSessionFinished(1, true);
+}
+
+TEST_F(ArcKioskBridgeTest, MaintenanceSessionNotFinished) {
+ EXPECT_CALL(*delegate_, OnMaintenanceSessionCreated()).Times(1);
+ kiosk_bridge_->OnMaintenanceSessionCreated(1);
+ EXPECT_CALL(*delegate_, OnMaintenanceSessionFinished()).Times(0);
+ kiosk_bridge_->OnMaintenanceSessionFinished(2, true);
+}
+
+} // namespace arc
« 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