Lines Matching refs:node
11 using mediaprovider::fuse::node;
21 uint32_t GetRefCount(node* node) { return node->refcount_; } in GetRefCount() argument
27 static void destroy(node* node) { delete node; } in destroy() argument
29 static void acquire(node* node) { node->Acquire(); } in acquire() argument
31 typedef std::unique_ptr<node, decltype(&NodeTest::destroy)> unique_node_ptr;
33 unique_node_ptr CreateNode(node* parent, const std::string& path, const int transforms = 0) { in CreateNode()
35 node::Create(parent, path, "", true, transforms, 0, &lock_, 0, &tracker_), in CreateNode()
39 static class node* ForChild(class node* node, const std::string& name, in ForChild() argument
40 const std::function<bool(class node*)>& callback) { in ForChild()
41 return node->ForChild(name, callback); in ForChild()
45 node::NodeCompare cmp;
49 unique_node_ptr node = CreateNode(nullptr, "/path"); in TEST_F() local
51 ASSERT_EQ("/path", node->GetName()); in TEST_F()
52 ASSERT_EQ(1, GetRefCount(node.get())); in TEST_F()
53 ASSERT_FALSE(node->HasCachedHandle()); in TEST_F()
70 node* node = node::Create(nullptr, "/path", "", true, 0, 0, &lock_, 0, &tracker_); in TEST_F() local
71 acquire(node); in TEST_F()
72 acquire(node); in TEST_F()
73 ASSERT_EQ(3, GetRefCount(node)); in TEST_F()
75 ASSERT_FALSE(node->Release(1)); in TEST_F()
76 ASSERT_EQ(2, GetRefCount(node)); in TEST_F()
79 ASSERT_FALSE(node->Release(10000)); in TEST_F()
80 ASSERT_EQ(2, GetRefCount(node)); in TEST_F()
83 ASSERT_TRUE(node->Release(2)); in TEST_F()
280 node* child = node::Create(parent.get(), "subdir", "", true, 0, 0, &lock_, 0, &tracker_); in TEST_F()
281 node::Create(child, "s1", "", true, 0, 0, &lock_, 0, &tracker_); in TEST_F()
282 node* subchild2 = node::Create(child, "s2", "", true, 0, 0, &lock_, 0, &tracker_); in TEST_F()
283 node::Create(subchild2, "sc2", "", true, 0, 0, &lock_, 0, &tracker_); in TEST_F()
286 node::DeleteTree(child); in TEST_F()
329 ASSERT_EQ(parent.get(), node::LookupAbsolutePath(parent.get(), "/path")); in TEST_F()
330 ASSERT_EQ(parent.get(), node::LookupAbsolutePath(parent.get(), "/path/")); in TEST_F()
331 ASSERT_EQ(nullptr, node::LookupAbsolutePath(parent.get(), "/path2")); in TEST_F()
333 ASSERT_EQ(child.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir")); in TEST_F()
334 ASSERT_EQ(child.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir/")); in TEST_F()
336 ASSERT_EQ(child.get(), node::LookupAbsolutePath(parent.get(), "/path//subdir")); in TEST_F()
337 ASSERT_EQ(child.get(), node::LookupAbsolutePath(parent.get(), "/path///subdir")); in TEST_F()
339 ASSERT_EQ(child2.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir2")); in TEST_F()
340 ASSERT_EQ(child2.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir2/")); in TEST_F()
342 ASSERT_EQ(nullptr, node::LookupAbsolutePath(parent.get(), "/path/subdir3/")); in TEST_F()
344 ASSERT_EQ(subchild.get(), node::LookupAbsolutePath(parent.get(), "/path/subdir2/subsubdir")); in TEST_F()
345 ASSERT_EQ(nullptr, node::LookupAbsolutePath(parent.get(), "/path/subdir/subsubdir")); in TEST_F()
349 unique_node_ptr node = CreateNode(nullptr, "/path"); in TEST_F() local
353 node->AddHandle(h); in TEST_F()
354 ASSERT_TRUE(node->HasCachedHandle()); in TEST_F()
356 node->DestroyHandle(h); in TEST_F()
357 ASSERT_FALSE(node->HasCachedHandle()); in TEST_F()
361 EXPECT_DEATH(node->DestroyHandle(h), ""); in TEST_F()
362 EXPECT_DEATH(node->DestroyHandle(nullptr), ""); in TEST_F()
366 EXPECT_DEATH(node->DestroyHandle(h2.get()), ""); in TEST_F()
370 unique_node_ptr node = CreateNode(nullptr, "/path"); in TEST_F() local
379 node->AddHandle(h); in TEST_F()
380 std::unique_ptr<mediaprovider::fuse::FdAccessResult> res(node->CheckHandleForUid(1)); in TEST_F()
386 unique_node_ptr node = CreateNode(nullptr, "/path"); in TEST_F() local
393 node->AddHandle(h); in TEST_F()
394 std::unique_ptr<mediaprovider::fuse::FdAccessResult> res(node->CheckHandleForUid(1)); in TEST_F()
400 unique_node_ptr node = CreateNode(nullptr, "/path"); in TEST_F() local
412 node->AddHandle(h1); in TEST_F()
413 node->AddHandle(h2); in TEST_F()
414 std::unique_ptr<mediaprovider::fuse::FdAccessResult> res(node->CheckHandleForUid(1)); in TEST_F()
420 unique_node_ptr node = CreateNode(nullptr, "/path"); in TEST_F() local
429 node->AddHandle(h); in TEST_F()
430 std::unique_ptr<mediaprovider::fuse::FdAccessResult> res(node->CheckHandleForUid(1)); in TEST_F()
436 unique_node_ptr node = CreateNode(nullptr, "/path"); in TEST_F() local
438 std::unique_ptr<mediaprovider::fuse::FdAccessResult> res(node->CheckHandleForUid(1)); in TEST_F()
447 node* upper_child = parent->LookupChildByName("CHILD", false /* acquire */); in TEST_F()
448 node* lower_child = parent->LookupChildByName("child", false /* acquire */); in TEST_F()
486 auto check_fn = [&](const node* lhs_node, const node* rhs_node) { in TEST_F()
512 auto test_fn = [&](const std::string& name, node* first, node* second) { in TEST_F()
536 std::vector<node*> match_all; in TEST_F()
537 auto test_fn_match_all = [&](node* child) { in TEST_F()
542 std::vector<node*> match_first; in TEST_F()
543 auto test_fn_match_first = [&](node* child) { in TEST_F()
548 std::vector<node*> match_none; in TEST_F()
549 auto test_fn_match_none = [&](node* child) { in TEST_F()
554 node* node_all = ForChild(parent.get(), "foo", test_fn_match_all); in TEST_F()
560 node* node_first = ForChild(parent.get(), "foo", test_fn_match_first); in TEST_F()
565 node* node_none = ForChild(parent.get(), "bar", test_fn_match_none); in TEST_F()