This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Switch macOS embedding to proc table embedder API #21811
Merged
stuartmorgan-g
merged 10 commits into
flutter:master
from
stuartmorgan-g:darwin-jump-table-tests
Nov 3, 2020
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
015cdfd
Switch macOS to proc table
stuartmorgan-g f35bb14
Standardize unit test file name for macOS to match iOS
stuartmorgan-g baa598a
Standardize test naming to be less redundant
stuartmorgan-g cbfb035
Fix overuse of ASSERT
stuartmorgan-g 08e701b
PoC test, with supporting macro
stuartmorgan-g dd5c644
Remove cruft
stuartmorgan-g e982221
License file updates
stuartmorgan-g 96062b7
Merge branch 'master' into darwin-jump-table-tests
stuartmorgan-g 5f9ff2d
Update recently added code to use the proc table
stuartmorgan-g 87d18d9
Update function names in test
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
shell/platform/darwin/macos/framework/Source/FlutterEngineTest.mm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#import "flutter/shell/platform/darwin/macos/framework/Headers/FlutterEngine.h" | ||
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterDartProject_Internal.h" | ||
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterEngine_Internal.h" | ||
#include "flutter/shell/platform/embedder/embedder.h" | ||
#include "flutter/shell/platform/embedder/test_utils/proc_table_replacement.h" | ||
#include "flutter/testing/testing.h" | ||
|
||
namespace flutter::testing { | ||
|
||
namespace { | ||
// Returns an engine configured for the text fixture resource configuration. | ||
FlutterEngine* CreateTestEngine() { | ||
NSString* fixtures = @(testing::GetFixturesPath()); | ||
FlutterDartProject* project = [[FlutterDartProject alloc] | ||
initWithAssetsPath:fixtures | ||
ICUDataPath:[fixtures stringByAppendingString:@"/icudtl.dat"]]; | ||
return [[FlutterEngine alloc] initWithName:@"test" project:project allowHeadlessExecution:true]; | ||
} | ||
} // namespace | ||
|
||
TEST(FlutterEngine, CanLaunch) { | ||
FlutterEngine* engine = CreateTestEngine(); | ||
EXPECT_TRUE([engine runWithEntrypoint:@"main"]); | ||
EXPECT_TRUE(engine.running); | ||
[engine shutDownEngine]; | ||
} | ||
|
||
TEST(FlutterEngine, MessengerSend) { | ||
FlutterEngine* engine = CreateTestEngine(); | ||
EXPECT_TRUE([engine runWithEntrypoint:@"main"]); | ||
|
||
NSData* test_message = [@"a message" dataUsingEncoding:NSUTF8StringEncoding]; | ||
bool called = false; | ||
|
||
engine.embedderAPI.SendPlatformMessage = MOCK_ENGINE_PROC( | ||
SendPlatformMessage, ([&called, test_message](auto engine, auto message) { | ||
called = true; | ||
EXPECT_STREQ(message->channel, "test"); | ||
EXPECT_EQ(memcmp(message->message, test_message.bytes, message->message_size), 0); | ||
return kSuccess; | ||
})); | ||
|
||
[engine.binaryMessenger sendOnChannel:@"test" message:test_message]; | ||
EXPECT_TRUE(called); | ||
|
||
[engine shutDownEngine]; | ||
} | ||
|
||
} // flutter::testing |
25 changes: 0 additions & 25 deletions
25
shell/platform/darwin/macos/framework/Source/FlutterEngineUnittests.mm
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this breaks FlutterEngine.mm due to a few symbols defined in the
#infndef FLUTTER_ENGINE_NO_PROTOTYPES
block added in #21813:FlutterEngineCollectAOTData
FlutterEngineRunsAOTCompiledDartCode
FlutterEngineCreateAOTData
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apparently didn't rebuild locally after rebasing on master 😳 The code that's not compiling is new, so hadn't been updated to use the proc table.