summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaichi Hirono2017-03-06 00:37:20 -0600
committerDaichi Hirono2017-03-23 02:22:03 -0500
commit96c6aa4f20717535921a927401cbfa16b56c193b (patch)
tree14d7d213b10f16d2feac08238d112ee9a5c5f5f2 /libappfuse/tests
parent2b9a3391d0928f49d264d920e6ba0288e2e83e44 (diff)
downloadplatform-system-core-96c6aa4f20717535921a927401cbfa16b56c193b.tar.gz
platform-system-core-96c6aa4f20717535921a927401cbfa16b56c193b.tar.xz
platform-system-core-96c6aa4f20717535921a927401cbfa16b56c193b.zip
Enable FuseBridgeLoop to accept new mount point after starting
The CL turns StartFuseBridgeLoop function into FuseBridgeLoop class, and adds a method adding new appfuse mount to the loop. After doing this, one FuseBridgeLoop can process FUSE commands from multiple AppFuse mounts. Bug: 34903085 Test: libappfuse_test Change-Id: I54f11f54bc26c551281b9c32e9bb91f8f043774c
Diffstat (limited to 'libappfuse/tests')
-rw-r--r--libappfuse/tests/FuseBridgeLoopTest.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/libappfuse/tests/FuseBridgeLoopTest.cc b/libappfuse/tests/FuseBridgeLoopTest.cc
index b4c1efb01..51d605136 100644
--- a/libappfuse/tests/FuseBridgeLoopTest.cc
+++ b/libappfuse/tests/FuseBridgeLoopTest.cc
@@ -32,10 +32,12 @@ namespace {
32class Callback : public FuseBridgeLoopCallback { 32class Callback : public FuseBridgeLoopCallback {
33 public: 33 public:
34 bool mounted; 34 bool mounted;
35 Callback() : mounted(false) {} 35 bool closed;
36 void OnMount() override { 36 Callback() : mounted(false), closed(false) {}
37 mounted = true; 37
38 } 38 void OnMount(int /*mount_id*/) override { mounted = true; }
39
40 void OnClosed(int /* mount_id */) override { closed = true; }
39}; 41};
40 42
41class FuseBridgeLoopTest : public ::testing::Test { 43class FuseBridgeLoopTest : public ::testing::Test {
@@ -53,8 +55,9 @@ class FuseBridgeLoopTest : public ::testing::Test {
53 ASSERT_TRUE(SetupMessageSockets(&dev_sockets_)); 55 ASSERT_TRUE(SetupMessageSockets(&dev_sockets_));
54 ASSERT_TRUE(SetupMessageSockets(&proxy_sockets_)); 56 ASSERT_TRUE(SetupMessageSockets(&proxy_sockets_));
55 thread_ = std::thread([this] { 57 thread_ = std::thread([this] {
56 StartFuseBridgeLoop( 58 FuseBridgeLoop loop;
57 dev_sockets_[1].release(), proxy_sockets_[0].release(), &callback_); 59 loop.AddBridge(1, std::move(dev_sockets_[1]), std::move(proxy_sockets_[0]));
60 loop.Start(&callback_);
58 }); 61 });
59 } 62 }
60 63
@@ -115,6 +118,7 @@ class FuseBridgeLoopTest : public ::testing::Test {
115 if (thread_.joinable()) { 118 if (thread_.joinable()) {
116 thread_.join(); 119 thread_.join();
117 } 120 }
121 ASSERT_TRUE(callback_.closed);
118 } 122 }
119 123
120 void TearDown() override { 124 void TearDown() override {