Update V8 to version 4.7.56.
[chromium-blink-merge.git] / media / base / android / test_statistics.h
blob9c889b49943c42984abb1b74a1771d74c3576ba7
1 // Copyright 2015 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.
5 #ifndef MEDIA_BASE_ANDROID_TEST_STATISTICS_H_
6 #define MEDIA_BASE_ANDROID_TEST_STATISTICS_H_
8 namespace media {
10 // Class that computes statistics: number of calls, minimum and maximum values.
11 // It is used for in tests PTS statistics to verify that playback did actually
12 // happen.
14 template <typename T>
15 class Minimax {
16 public:
17 Minimax() : num_values_(0) {}
18 ~Minimax() {}
20 void AddValue(const T& value) {
21 if (num_values_ == 0)
22 min_ = max_ = value;
23 else if (value < min_)
24 min_ = value;
25 else if (max_ < value)
26 max_ = value;
28 ++num_values_;
31 void Clear() {
32 min_ = T();
33 max_ = T();
34 num_values_ = 0;
37 const T& min() const { return min_; }
38 const T& max() const { return max_; }
39 int num_values() const { return num_values_; }
41 private:
42 T min_;
43 T max_;
44 int num_values_;
47 } // namespace media
49 #endif // MEDIA_BASE_ANDROID_TEST_STATISTICS_H_