@@ -127,88 +127,4 @@ - (void)testAwaitAndPauseWillWorkCorrectly {
127127 XCTAssertTrue (link.isPaused );
128128}
129129
130- - (void )testRefreshRateUpdatedTo80WhenThraedsMerge {
131- auto platform_thread_task_runner = CreateNewThread (" Platform" );
132- auto raster_thread_task_runner = CreateNewThread (" Raster" );
133- auto ui_thread_task_runner = CreateNewThread (" UI" );
134- auto io_thread_task_runner = CreateNewThread (" IO" );
135- auto task_runners =
136- flutter::TaskRunners (" test" , platform_thread_task_runner, raster_thread_task_runner,
137- ui_thread_task_runner, io_thread_task_runner);
138-
139- id mockDisplayLinkManager = [OCMockObject mockForClass: [DisplayLinkManager class ]];
140- double maxFrameRate = 120 ;
141- [[[mockDisplayLinkManager stub ] andReturnValue: @(maxFrameRate)] displayRefreshRate ];
142- [[[mockDisplayLinkManager stub ] andReturnValue: @(YES )] maxRefreshRateEnabledOnIPhone ];
143- auto vsync_waiter = flutter::VsyncWaiterIOS (task_runners);
144-
145- fml::scoped_nsobject<VSyncClient> vsyncClient = vsync_waiter.GetVsyncClient ();
146- CADisplayLink * link = [vsyncClient.get () getDisplayLink ];
147-
148- if (@available (iOS 15.0 , *)) {
149- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .maximum , maxFrameRate, 0.1 );
150- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .preferred , maxFrameRate, 0.1 );
151- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .minimum , maxFrameRate / 2 , 0.1 );
152- } else {
153- XCTAssertEqualWithAccuracy (link.preferredFramesPerSecond , maxFrameRate, 0.1 );
154- }
155-
156- const auto merger = fml::RasterThreadMerger::CreateOrShareThreadMerger (
157- nullptr , platform_thread_task_runner->GetTaskQueueId (),
158- raster_thread_task_runner->GetTaskQueueId ());
159-
160- merger->MergeWithLease (5 );
161- vsync_waiter.AwaitVSync ();
162-
163- if (@available (iOS 15.0 , *)) {
164- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .maximum , 80 , 0.1 );
165- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .preferred , 80 , 0.1 );
166- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .minimum , 60 , 0.1 );
167- } else {
168- XCTAssertEqualWithAccuracy (link.preferredFramesPerSecond , 80 , 0.1 );
169- }
170-
171- merger->UnMergeNowIfLastOne ();
172- vsync_waiter.AwaitVSync ();
173-
174- if (@available (iOS 15.0 , *)) {
175- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .maximum , maxFrameRate, 0.1 );
176- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .preferred , maxFrameRate, 0.1 );
177- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .minimum , maxFrameRate / 2 , 0.1 );
178- } else {
179- XCTAssertEqualWithAccuracy (link.preferredFramesPerSecond , maxFrameRate, 0.1 );
180- }
181-
182- if (@available (iOS 14.0 , *)) {
183- // Fake response that we are running on Mac.
184- id processInfo = [NSProcessInfo processInfo ];
185- id processInfoPartialMock = OCMPartialMock (processInfo);
186- bool iOSAppOnMac = true ;
187- [OCMStub ([processInfoPartialMock isiOSAppOnMac ]) andReturnValue: OCMOCK_VALUE (iOSAppOnMac)];
188-
189- merger->MergeWithLease (5 );
190- vsync_waiter.AwaitVSync ();
191-
192- // On Mac, framerate should be uncapped.
193- if (@available (iOS 15.0 , *)) {
194- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .maximum , maxFrameRate, 0.1 );
195- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .preferred , maxFrameRate, 0.1 );
196- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .minimum , maxFrameRate / 2 , 0.1 );
197- } else {
198- XCTAssertEqualWithAccuracy (link.preferredFramesPerSecond , 80 , 0.1 );
199- }
200-
201- merger->UnMergeNowIfLastOne ();
202- vsync_waiter.AwaitVSync ();
203-
204- if (@available (iOS 15.0 , *)) {
205- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .maximum , maxFrameRate, 0.1 );
206- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .preferred , maxFrameRate, 0.1 );
207- XCTAssertEqualWithAccuracy (link.preferredFrameRateRange .minimum , maxFrameRate / 2 , 0.1 );
208- } else {
209- XCTAssertEqualWithAccuracy (link.preferredFramesPerSecond , maxFrameRate, 0.1 );
210- }
211- }
212- }
213-
214130@end
0 commit comments