1 /*
2  * Copyright 2019 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "stack_manager.h"
18 
19 #include "gtest/gtest.h"
20 #include "os/thread.h"
21 
22 namespace bluetooth {
23 namespace {
24 
TEST(StackManagerTest,DISABLED_start_and_shutdown_no_module)25 TEST(StackManagerTest, DISABLED_start_and_shutdown_no_module) {
26   StackManager stack_manager;
27   ModuleList module_list;
28   os::Thread thread{"test_thread", os::Thread::Priority::NORMAL};
29   stack_manager.StartUp(&module_list, &thread);
30   stack_manager.ShutDown();
31 }
32 
33 class TestModuleNoDependency : public Module {
34  public:
35   static const ModuleFactory Factory;
36 
37  protected:
ListDependencies(ModuleList *) const38   void ListDependencies(ModuleList* /* list */) const {}
Start()39   void Start() override {}
Stop()40   void Stop() override {}
ToString() const41   std::string ToString() const override {
42     return std::string("TestModuleDep");
43   }
44 };
45 
__anon656eef4b0202() 46 const ModuleFactory TestModuleNoDependency::Factory = ModuleFactory([]() { return new TestModuleNoDependency(); });
47 
TEST(StackManagerTest,DISABLED_get_module_instance)48 TEST(StackManagerTest, DISABLED_get_module_instance) {
49   StackManager stack_manager;
50   ModuleList module_list;
51   module_list.add<TestModuleNoDependency>();
52   os::Thread thread{"test_thread", os::Thread::Priority::NORMAL};
53   stack_manager.StartUp(&module_list, &thread);
54   EXPECT_NE(stack_manager.GetInstance<TestModuleNoDependency>(), nullptr);
55   stack_manager.ShutDown();
56 }
57 
58 }  // namespace
59 }  // namespace bluetooth
60