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

Unified Diff: ios/chrome/browser/ui/ntp/new_tab_page_perftest.mm

Issue 2589803002: Upstream Chrome on iOS source code [6/11]. (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/ntp/new_tab_page_perftest.mm
diff --git a/ios/chrome/browser/ui/ntp/new_tab_page_perftest.mm b/ios/chrome/browser/ui/ntp/new_tab_page_perftest.mm
new file mode 100644
index 0000000000000000000000000000000000000000..eabe37de598633424821d65dae2b91d52eb6df4e
--- /dev/null
+++ b/ios/chrome/browser/ui/ntp/new_tab_page_perftest.mm
@@ -0,0 +1,73 @@
+// Copyright 2012 The Chromium 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 "base/test/ios/wait_util.h"
+#include "ios/chrome/browser/sessions/ios_chrome_tab_restore_service_factory.h"
+#import "ios/chrome/browser/tabs/tab_model.h"
+#include "ios/chrome/browser/test/perf_test_with_bvc_ios.h"
+#import "ios/chrome/browser/ui/browser_view_controller.h"
+#import "ios/chrome/browser/ui/browser_view_controller_dependency_factory.h"
+
+namespace {
+
+const NSTimeInterval kMaxUICatchupDelay = 2.0; // seconds
+
+class NewTabPagePerfTest : public PerfTestWithBVC {
+ public:
+ NewTabPagePerfTest()
+ : PerfTestWithBVC("NTP - Create",
+ "First Tab",
+ "",
+ false,
+ false,
+ true,
+ 10) {}
+
+ protected:
+ void SetUp() override {
+ PerfTestWithBVC::SetUp();
+ IOSChromeTabRestoreServiceFactory::GetInstance()->SetTestingFactory(
+ chrome_browser_state_.get(),
+ IOSChromeTabRestoreServiceFactory::GetDefaultFactory());
+ }
+ base::TimeDelta TimedNewTab() {
+ base::Time startTime = base::Time::NowFromSystemTime();
+ [bvc_ newTab:nil];
+ return base::Time::NowFromSystemTime() - startTime;
+ }
+ void SettleUI() {
+ base::test::ios::WaitUntilCondition(
+ nil, nullptr, base::TimeDelta::FromSecondsD(kMaxUICatchupDelay));
+ }
+};
+
+// Output format first test:
+// [*]RESULT NTP - Create: NTP Gentle Create First Tab= number ms
+// Output format subsequent average:
+// [*]RESULT NTP - Create: NTP Gentle Create= number ms
+TEST_F(NewTabPagePerfTest, OpenNTP_Gentle) {
+ RepeatTimedRuns("NTP Gentle Create",
+ ^(int index) {
+ return TimedNewTab();
+ },
+ ^{
+ SettleUI();
+ });
+}
+
+// Output format first test:
+// [*]RESULT NTP - Create: NTP Hammer Create First Tab= number ms
+// Output format subsequent average:
+// [*]RESULT NTP - Create: NTP Hammer Create= number ms
+TEST_F(NewTabPagePerfTest, OpenNTP_Hammer) {
+ RepeatTimedRuns("NTP Hammer Create",
+ ^(int index) {
+ return TimedNewTab();
+ },
+ nil);
+ // Allows the run loops to run before teardown.
+ SettleUI();
+}
+
+} // anonymous namespace
« no previous file with comments | « ios/chrome/browser/ui/ntp/new_tab_page_panel_protocol.mm ('k') | ios/chrome/browser/ui/ntp/new_tab_page_toolbar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698