[macOS] Replace fixture subclasses with usings (flutter/engine#48111)
In cases where we subclassed gtest fixtures purely to get better naming for test output (i.e. displaying/filtering on AccessibilityBridgeMacTest instead of AutoreleasePoolTest, replace these with `using` declarations, which is equally effective and avoids actually subclassing. This applies no semantic changes to the code or tests. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
@@ -80,18 +80,11 @@ class AccessibilityBridgeMacWindowTest : public AutoreleasePoolTest {
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridgeMacWindowTest);
|
||||
};
|
||||
|
||||
// AutoreleasePoolTest subclass that exists simply to provide more specific naming.
|
||||
class AccessibilityBridgeMacTest : public AutoreleasePoolTest {
|
||||
public:
|
||||
AccessibilityBridgeMacTest() = default;
|
||||
~AccessibilityBridgeMacTest() = default;
|
||||
|
||||
private:
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(AccessibilityBridgeMacTest);
|
||||
};
|
||||
|
||||
NSWindow* AccessibilityBridgeMacWindowTest::gWindow_ = nil;
|
||||
|
||||
// Test-specific name for AutoreleasePoolTest fixture.
|
||||
using AccessibilityBridgeMacTest = AutoreleasePoolTest;
|
||||
|
||||
} // namespace
|
||||
|
||||
TEST_F(AccessibilityBridgeMacWindowTest, SendsAccessibilityCreateNotificationFlutterViewWindow) {
|
||||
|
||||
@@ -67,15 +67,8 @@
|
||||
|
||||
namespace flutter::testing {
|
||||
|
||||
// AutoreleasePoolTest subclass that exists simply to provide more specific naming.
|
||||
class FlutterEmbedderExternalTextureTest : public AutoreleasePoolTest {
|
||||
public:
|
||||
FlutterEmbedderExternalTextureTest() = default;
|
||||
~FlutterEmbedderExternalTextureTest() = default;
|
||||
|
||||
private:
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(FlutterEmbedderExternalTextureTest);
|
||||
};
|
||||
// Test-specific name for AutoreleasePoolTest fixture.
|
||||
using FlutterEmbedderExternalTextureTest = AutoreleasePoolTest;
|
||||
|
||||
TEST_F(FlutterEmbedderExternalTextureTest, TestTextureResolution) {
|
||||
// Constants.
|
||||
|
||||
@@ -174,25 +174,9 @@ NSEvent* CreateMouseEvent(NSEventModifierFlags modifierFlags) {
|
||||
|
||||
#pragma mark - gtest tests
|
||||
|
||||
// AutoreleasePoolTest subclass that exists simply to provide more specific naming.
|
||||
class FlutterViewControllerTest : public AutoreleasePoolTest {
|
||||
public:
|
||||
FlutterViewControllerTest() = default;
|
||||
~FlutterViewControllerTest() = default;
|
||||
|
||||
private:
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(FlutterViewControllerTest);
|
||||
};
|
||||
|
||||
// MockFlutterEngineTest subclass that exists simply to provide more specific naming.
|
||||
class FlutterViewControllerMockEngineTest : public MockFlutterEngineTest {
|
||||
public:
|
||||
FlutterViewControllerMockEngineTest() = default;
|
||||
~FlutterViewControllerMockEngineTest() = default;
|
||||
|
||||
private:
|
||||
FML_DISALLOW_COPY_AND_ASSIGN(FlutterViewControllerMockEngineTest);
|
||||
};
|
||||
// Test-specific names for AutoreleasePoolTest, MockFlutterEngineTest fixtures.
|
||||
using FlutterViewControllerTest = AutoreleasePoolTest;
|
||||
using FlutterViewControllerMockEngineTest = MockFlutterEngineTest;
|
||||
|
||||
TEST_F(FlutterViewControllerTest, HasViewThatHidesOtherViewsInAccessibility) {
|
||||
FlutterViewController* viewControllerMock = CreateMockViewController();
|
||||
|
||||
Reference in New Issue
Block a user