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 { return std::string("TestModuleDep"); }
42 };
43
44 const ModuleFactory TestModuleNoDependency::Factory =
__anon6fda35010202() 45 ModuleFactory([]() { return new TestModuleNoDependency(); });
46
TEST(StackManagerTest,DISABLED_get_module_instance)47 TEST(StackManagerTest, DISABLED_get_module_instance) {
48 StackManager stack_manager;
49 ModuleList module_list;
50 module_list.add<TestModuleNoDependency>();
51 os::Thread thread{"test_thread", os::Thread::Priority::NORMAL};
52 stack_manager.StartUp(&module_list, &thread);
53 EXPECT_NE(stack_manager.GetInstance<TestModuleNoDependency>(), nullptr);
54 stack_manager.ShutDown();
55 }
56
57 } // namespace
58 } // namespace bluetooth
59