Skip to content

Commit 3949784

Browse files
harimau-qirexpull[bot]
authored andcommitted
Fix the fake platform's implementation of ConfigurationManagerImpl. (#11638)
* Move the global methods to the implementation. * Add ConfigurationManagerImpl::GetDefaultInstance, which is required by tests.
1 parent 57ade85 commit 3949784

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

src/platform/fake/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ assert(chip_device_platform == "fake")
2121
static_library("fake") {
2222
sources = [
2323
"CHIPDevicePlatformEvent.h",
24+
"ConfigurationManagerImpl.cpp",
2425
"ConfigurationManagerImpl.h",
2526
"ConnectivityManagerImpl.cpp",
2627
"ConnectivityManagerImpl.h",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
*
3+
* Copyright (c) 2021 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* limitations under the License.
9+
*/
10+
11+
#include <platform/ConfigurationManager.h>
12+
13+
namespace chip {
14+
namespace DeviceLayer {
15+
16+
ConfigurationManagerImpl & ConfigurationManagerImpl::GetDefaultInstance()
17+
{
18+
static ConfigurationManagerImpl sInstance;
19+
return sInstance;
20+
}
21+
22+
ConfigurationManager & ConfigurationMgr()
23+
{
24+
return ConfigurationManagerImpl::GetDefaultInstance();
25+
}
26+
27+
void SetConfigurationMgr(ConfigurationManager * configurationManager) {}
28+
29+
} // namespace DeviceLayer
30+
} // namespace chip

src/platform/fake/ConfigurationManagerImpl.h

+3-8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ class ConfigurationManagerImpl : public ConfigurationManager
2929
{
3030
public:
3131
virtual ~ConfigurationManagerImpl() = default;
32+
// NOTE: This method is required by the tests.
33+
// This returns an instance of this class.
34+
static ConfigurationManagerImpl & GetDefaultInstance();
3235

3336
private:
3437
CHIP_ERROR Init() override { return CHIP_NO_ERROR; }
@@ -105,13 +108,5 @@ class ConfigurationManagerImpl : public ConfigurationManager
105108
// NOTE: Other public interface methods are implemented by GenericConfigurationManagerImpl<>.
106109
};
107110

108-
ConfigurationManager & ConfigurationMgr()
109-
{
110-
static ConfigurationManagerImpl sInstance;
111-
return sInstance;
112-
}
113-
114-
void SetConfigurationMgr(ConfigurationManagerImpl * configurationManager) {}
115-
116111
} // namespace DeviceLayer
117112
} // namespace chip

0 commit comments

Comments
 (0)