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

Side by Side Diff: ios/chrome/test/base/perf_test_ios.h

Issue 2580333003: Upstream Chrome on iOS source code [10/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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef IOS_CHROME_TEST_BASE_PERF_TEST_IOS_H_
6 #define IOS_CHROME_TEST_BASE_PERF_TEST_IOS_H_
7
8 #import <Foundation/Foundation.h>
9
10 #include "base/ios/block_types.h"
11 #include "base/time/time.h"
12 #import "ios/chrome/test/block_cleanup_test.h"
13 #include "ios/web/public/test/scoped_testing_web_client.h"
14 #include "ios/web/public/test/test_web_thread_bundle.h"
15
16 typedef base::TimeDelta (^TimedActionBlock)(int index);
17
18 // Base class for PerfTest providing some common functions that are
19 // generally useful.
20 class PerfTest : public BlockCleanupTest {
21 public:
22 explicit PerfTest(std::string testGroup);
23 PerfTest(std::string testGroup,
24 std::string firstLabel,
25 std::string averageLabel,
26 bool isWaterfall,
27 bool verbose,
28 int repeat);
29 ~PerfTest() override;
30
31 // Convenience methods to display the performance timing data.
32 // All recorded values will show up on the bot performance graphs. If
33 // |isWaterfall_| is true, the performance data recorded will show up on the
34 // waterfall. In the majority of the cases, |isWaterfall_| should be false.
35 virtual void LogPerfValue(std::string testName,
36 double value,
37 std::string unit);
38 virtual void LogPerfTiming(std::string testName, base::TimeDelta elapsed);
39
40 // Utility method to run a test multiple times.
41 // The first run is counted separately to account for possible lazy
42 // initialization overhead. Subsequent run times are averaged to provide
43 // reliable timings for comparison.
44 virtual void RepeatTimedRuns(std::string testName,
45 TimedActionBlock timedAction,
46 ProceduralBlock postAction);
47 virtual void RepeatTimedRuns(std::string testName,
48 TimedActionBlock timedAction,
49 ProceduralBlock postAction,
50 int repeatCount);
51
52 // Computes the average time, and, optionally, returns the maximum and
53 // minimum times seen.
54 static base::TimeDelta CalculateAverage(base::TimeDelta* times,
55 int count,
56 base::TimeDelta* min_time,
57 base::TimeDelta* max_time);
58
59 private:
60 // Name for this group of perf tests.
61 std::string testGroup_;
62 // The label added to the first test of multiple tests.
63 std::string firstLabel_;
64 // The label added to the average number for multiple tests.
65 std::string averageLabel_;
66 // Whether the test result should appear in the waterfall.
67 bool isWaterfall_;
68 // Flag to show generate more output.
69 bool verbose_;
70 // Sets number of times to repeat a test when ran with RepeatTimedRuns.
71 int repeatCount_;
72 // The threads used for testing.
73 web::TestWebThreadBundle thread_bundle_;
74 // The WebClient for testing purposes.
75 web::ScopedTestingWebClient web_client_;
76 };
77
78 #endif // IOS_CHROME_TEST_BASE_PERF_TEST_IOS_H_
OLDNEW
« no previous file with comments | « ios/chrome/test/app/web_view_interaction_test_util.mm ('k') | ios/chrome/test/base/perf_test_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698