Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: ios/chrome/browser/ui/stack_view/stack_view_controller_perftest.mm

Issue 2616843002: Remove deprecated wait_util methods. (Closed)
Patch Set: Convert remaining uses of WaitUntilCondition. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import <UIKit/UIKit.h> 5 #import <UIKit/UIKit.h>
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #import "base/mac/bind_objc_block.h" 8 #import "base/mac/bind_objc_block.h"
9 #include "base/mac/foundation_util.h" 9 #include "base/mac/foundation_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 const GURL StackViewControllerPerfTest::GoogleURL() { 251 const GURL StackViewControllerPerfTest::GoogleURL() {
252 return GURL("http://www.google.com"); 252 return GURL("http://www.google.com");
253 } 253 }
254 254
255 void StackViewControllerPerfTest::WaitForPageLoad(Tab* tab) { 255 void StackViewControllerPerfTest::WaitForPageLoad(Tab* tab) {
256 base::test::ios::WaitUntilCondition( 256 base::test::ios::WaitUntilCondition(
257 ^bool() { 257 ^bool() {
258 return !tab.webState->IsLoading(); 258 return !tab.webState->IsLoading();
259 }, 259 },
260 nullptr, base::TimeDelta::FromSecondsD(kMaxPageLoadDelay)); 260 false, base::TimeDelta::FromSecondsD(kMaxPageLoadDelay));
261 base::test::ios::WaitUntilCondition( 261 base::test::ios::WaitUntilCondition(
262 nil, nullptr, base::TimeDelta::FromSecondsD(kMaxUICatchupDelay)); 262 nil, false, base::TimeDelta::FromSecondsD(kMaxUICatchupDelay));
263 } 263 }
264 264
265 base::TimeDelta StackViewControllerPerfTest::OpenStackView() { 265 base::TimeDelta StackViewControllerPerfTest::OpenStackView() {
266 return base::test::ios::TimeUntilCondition( 266 return base::test::ios::TimeUntilCondition(
267 ^{ 267 ^{
268 [delegate_ reinitialize]; 268 [delegate_ reinitialize];
269 MainControllerShowTabSwitcher(); 269 MainControllerShowTabSwitcher();
270 }, 270 },
271 ^bool() { 271 ^bool() {
272 return [delegate_ showAnimationEnded]; 272 return [delegate_ showAnimationEnded];
273 }, 273 },
274 nullptr, base::TimeDelta::FromSecondsD(kTotalSpinDelay)); 274 false, base::TimeDelta::FromSecondsD(kTotalSpinDelay));
275 } 275 }
276 276
277 void StackViewControllerPerfTest::MainControllerShowTabSwitcher() { 277 void StackViewControllerPerfTest::MainControllerShowTabSwitcher() {
278 // The code for this function is copied from MainController -showTabSwitcher. 278 // The code for this function is copied from MainController -showTabSwitcher.
279 // Note that if the code there changes, this code should change to match. 279 // Note that if the code there changes, this code should change to match.
280 Tab* currentTab = [[bvc_ tabModel] currentTab]; 280 Tab* currentTab = [[bvc_ tabModel] currentTab];
281 281
282 // In order to generate the transition between the current browser view 282 // In order to generate the transition between the current browser view
283 // controller and the tab switcher controller it's possible that multiple 283 // controller and the tab switcher controller it's possible that multiple
284 // screenshots of the same tab are taken. Since taking a screenshot is 284 // screenshots of the same tab are taken. Since taking a screenshot is
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 // Spin and wait for the dismiss stack view animation to finish. 319 // Spin and wait for the dismiss stack view animation to finish.
320 base::test::ios::TimeUntilCondition( 320 base::test::ios::TimeUntilCondition(
321 ^{ 321 ^{
322 [view_controller_ dismissWithSelectedTabAnimation]; 322 [view_controller_ dismissWithSelectedTabAnimation];
323 EXPECT_TRUE([delegate_ dismissAnimationStarted]); 323 EXPECT_TRUE([delegate_ dismissAnimationStarted]);
324 EXPECT_FALSE([delegate_ dismissAnimationEnded]); 324 EXPECT_FALSE([delegate_ dismissAnimationEnded]);
325 }, 325 },
326 ^bool() { 326 ^bool() {
327 return [delegate_ dismissAnimationEnded]; 327 return [delegate_ dismissAnimationEnded];
328 }, 328 },
329 nullptr, base::TimeDelta::FromSecondsD(kTotalSpinDelay)); 329 false, base::TimeDelta::FromSecondsD(kTotalSpinDelay));
330 330
331 [view_controller_ dismissViewControllerAnimated:NO completion:nil]; 331 [view_controller_ dismissViewControllerAnimated:NO completion:nil];
332 if (!reuse_svc_) 332 if (!reuse_svc_)
333 view_controller_.reset(); 333 view_controller_.reset();
334 334
335 base::TimeDelta closeTime = base::Time::NowFromSystemTime() - startTime; 335 base::TimeDelta closeTime = base::Time::NowFromSystemTime() - startTime;
336 336
337 // Run the runloop a bit longer to give time for temporary retains that happen 337 // Run the runloop a bit longer to give time for temporary retains that happen
338 // in the OS during view teardown to resolve, so that the view gets its 338 // in the OS during view teardown to resolve, so that the view gets its
339 // dismissal callbacks. 339 // dismissal callbacks.
340 base::test::ios::WaitUntilCondition( 340 base::test::ios::WaitUntilCondition(
341 nil, nullptr, base::TimeDelta::FromSecondsD(kSpinDelay)); 341 nil, false, base::TimeDelta::FromSecondsD(kSpinDelay));
342 342
343 return closeTime; 343 return closeTime;
344 } 344 }
345 345
346 base::TimeDelta StackViewControllerPerfTest::TakeSnapshot() { 346 base::TimeDelta StackViewControllerPerfTest::TakeSnapshot() {
347 base::Time startTime = base::Time::NowFromSystemTime(); 347 base::Time startTime = base::Time::NowFromSystemTime();
348 UIImage* image = [[tab_model_ currentTab] updateSnapshotWithOverlay:YES 348 UIImage* image = [[tab_model_ currentTab] updateSnapshotWithOverlay:YES
349 visibleFrameOnly:YES]; 349 visibleFrameOnly:YES];
350 base::TimeDelta elapsed = base::Time::NowFromSystemTime() - startTime; 350 base::TimeDelta elapsed = base::Time::NowFromSystemTime() - startTime;
351 EXPECT_TRUE(image); 351 EXPECT_TRUE(image);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 CalculateAverage(close_times + 1, kNumTests - 1, NULL, &max_close); 397 CalculateAverage(close_times + 1, kNumTests - 1, NULL, &max_close);
398 LogPerfTiming("Open cold", open_times[0]); 398 LogPerfTiming("Open cold", open_times[0]);
399 LogPerfTiming("Open warm avg", open_avg); 399 LogPerfTiming("Open warm avg", open_avg);
400 LogPerfTiming("Open warm max", max_open); 400 LogPerfTiming("Open warm max", max_open);
401 LogPerfTiming("Close cold", close_times[0]); 401 LogPerfTiming("Close cold", close_times[0]);
402 LogPerfTiming("Close cold avg", close_avg); 402 LogPerfTiming("Close cold avg", close_avg);
403 LogPerfTiming("Close cold max", max_close); 403 LogPerfTiming("Close cold max", max_close);
404 } 404 }
405 405
406 } // anonymous namespace 406 } // anonymous namespace
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/omnibox_perftest.mm ('k') | ios/web/public/test/web_test_with_web_state.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698