Make System::Layer mockable (#9546)
* Make System::Layer mockable
#### Problem
System::Layer is now an abstract base class, but in normal builds is
still accessed through a static global variable.
#### Change overview
Replace the direct global access `DeviceLayer::SystemLayer` with
a function indirecting through a pointer. In the normal case, the
pointer is initialized by `InitChipStack()` with the global, but
it can be set with a mock implementation before that.
#### Testing
Added a unit test case to TestPlatformMgr.
* rename globals in line with comments on #9547
diff --git a/src/platform/P6/BLEManagerImpl.cpp b/src/platform/P6/BLEManagerImpl.cpp
index ec058c5..6bc0365 100644
--- a/src/platform/P6/BLEManagerImpl.cpp
+++ b/src/platform/P6/BLEManagerImpl.cpp
@@ -93,7 +93,7 @@
CHIP_ERROR err;
// Initialize the CHIP BleLayer.
- err = BleLayer::Init(this, this, &SystemLayer);
+ err = BleLayer::Init(this, this, &DeviceLayer::SystemLayer());
SuccessOrExit(err);
// Configure platform specific settings for Bluetooth