#include "flutter/fml/synchronization/waitable_event.h"
#import "flutter/shell/platform/darwin/macos/framework/Source/FlutterResizeSynchronizer.h"
#import "flutter/testing/testing.h"
Go to the source code of this file.
|
| | TEST (FlutterThreadSynchronizerTest, NotBlocked) |
| |
| | TEST (FlutterThreadSynchronizerTest, WaitForResize) |
| |
| | TEST (FlutterThreadSynchronizerTest, UnblocksOnShutDown) |
| |
◆ TEST() [1/3]
| TEST |
( |
FlutterThreadSynchronizerTest |
, |
|
|
NotBlocked |
|
|
) |
| |
Definition at line 9 of file FlutterResizeSynchronizerTest.mm.
13 __block BOOL performed = NO;
15 [NSThread detachNewThreadWithBlock:^{
16 [synchronizer performCommitForSize:CGSizeMake(100, 100)
23 CFTimeInterval start = CFAbsoluteTimeGetCurrent();
25 while (!performed && CFAbsoluteTimeGetCurrent() - start < 1.0) {
28 EXPECT_EQ(performed, YES);
FlutterRunLoop * mainRunLoop()
References FlutterRunLoop::mainRunLoop.
◆ TEST() [2/3]
| TEST |
( |
FlutterThreadSynchronizerTest |
, |
|
|
UnblocksOnShutDown |
|
|
) |
| |
Definition at line 84 of file FlutterResizeSynchronizerTest.mm.
90 __block BOOL didReceiveFrame = NO;
91 [synchronizer performCommitForSize:CGSizeMake(10, 10)
93 didReceiveFrame = YES;
97 CFTimeInterval start = CFAbsoluteTimeGetCurrent();
98 while (!didReceiveFrame && CFAbsoluteTimeGetCurrent() - start < 1.0) {
102 fml::AutoResetWaitableEvent latch_;
103 fml::AutoResetWaitableEvent& latch = latch_;
105 [NSThread detachNewThreadWithBlock:^{
108 [synchronizer shutDown];
111 [synchronizer beginResizeForSize:CGSizeMake(100, 100)
118 [synchronizer beginResizeForSize:CGSizeMake(100, 100)
References FlutterRunLoop::mainRunLoop.
◆ TEST() [3/3]
| TEST |
( |
FlutterThreadSynchronizerTest |
, |
|
|
WaitForResize |
|
|
) |
| |
Definition at line 31 of file FlutterResizeSynchronizerTest.mm.
36 __block BOOL commit1 = NO;
37 __block BOOL commit2 = NO;
41 fml::AutoResetWaitableEvent latch_;
42 fml::AutoResetWaitableEvent& latch = latch_;
45 __block BOOL didReceiveFrame = NO;
46 [synchronizer performCommitForSize:CGSizeMake(10, 10)
48 didReceiveFrame = YES;
52 CFTimeInterval start = CFAbsoluteTimeGetCurrent();
53 while (!didReceiveFrame && CFAbsoluteTimeGetCurrent() - start < 1.0) {
59 [NSThread detachNewThreadWithBlock:^{
62 [synchronizer performCommitForSize:CGSizeMake(50, 100)
68 [synchronizer performCommitForSize:CGSizeMake(100, 100)
75 [synchronizer beginResizeForSize:CGSizeMake(100, 100)
80 EXPECT_EQ(commit1, YES);
81 EXPECT_EQ(commit2, YES);
References FlutterRunLoop::mainRunLoop.