| OLD | NEW |
| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 | 349 |
| 350 base::TimeDelta StackViewControllerPerfTest::TakeSnapshot() { | 350 base::TimeDelta StackViewControllerPerfTest::TakeSnapshot() { |
| 351 base::Time startTime = base::Time::NowFromSystemTime(); | 351 base::Time startTime = base::Time::NowFromSystemTime(); |
| 352 UIImage* image = [[tab_model_ currentTab] updateSnapshotWithOverlay:YES | 352 UIImage* image = [[tab_model_ currentTab] updateSnapshotWithOverlay:YES |
| 353 visibleFrameOnly:YES]; | 353 visibleFrameOnly:YES]; |
| 354 base::TimeDelta elapsed = base::Time::NowFromSystemTime() - startTime; | 354 base::TimeDelta elapsed = base::Time::NowFromSystemTime() - startTime; |
| 355 EXPECT_TRUE(image); | 355 EXPECT_TRUE(image); |
| 356 return elapsed; | 356 return elapsed; |
| 357 } | 357 } |
| 358 | 358 |
| 359 TEST_F(StackViewControllerPerfTest, WebView_Shapshot) { | 359 // TODO(crbug.com/717314): Failed DCHECK in PerfTestWithBVC::SetUp(). |
| 360 TEST_F(StackViewControllerPerfTest, DISABLED_WebView_Shapshot) { |
| 360 // Opening a StackViewController is done only on iPhones, not on iPads. | 361 // Opening a StackViewController is done only on iPhones, not on iPads. |
| 361 // This test is meaningless on an iPad. | 362 // This test is meaningless on an iPad. |
| 362 if (IsIPadIdiom()) | 363 if (IsIPadIdiom()) |
| 363 return; | 364 return; |
| 364 const int kNumTests = 10; | 365 const int kNumTests = 10; |
| 365 base::TimeDelta times[kNumTests]; | 366 base::TimeDelta times[kNumTests]; |
| 366 CreateTabs(1, false); | 367 CreateTabs(1, false); |
| 367 for (int i = 0; i < kNumTests; i++) { | 368 for (int i = 0; i < kNumTests; i++) { |
| 368 times[i] = TakeSnapshot(); | 369 times[i] = TakeSnapshot(); |
| 369 LoadNextURL(); | 370 LoadNextURL(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 CalculateAverage(close_times + 1, kNumTests - 1, NULL, &max_close); | 402 CalculateAverage(close_times + 1, kNumTests - 1, NULL, &max_close); |
| 402 LogPerfTiming("Open cold", open_times[0]); | 403 LogPerfTiming("Open cold", open_times[0]); |
| 403 LogPerfTiming("Open warm avg", open_avg); | 404 LogPerfTiming("Open warm avg", open_avg); |
| 404 LogPerfTiming("Open warm max", max_open); | 405 LogPerfTiming("Open warm max", max_open); |
| 405 LogPerfTiming("Close cold", close_times[0]); | 406 LogPerfTiming("Close cold", close_times[0]); |
| 406 LogPerfTiming("Close cold avg", close_avg); | 407 LogPerfTiming("Close cold avg", close_avg); |
| 407 LogPerfTiming("Close cold max", max_close); | 408 LogPerfTiming("Close cold max", max_close); |
| 408 } | 409 } |
| 409 | 410 |
| 410 } // anonymous namespace | 411 } // anonymous namespace |
| OLD | NEW |