OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ppapi/tests/test_uma.h" | 5 #include "ppapi/tests/test_uma.h" |
6 | 6 |
7 #include "ppapi/c/private/ppb_uma_private.h" | 7 #include "ppapi/c/private/ppb_uma_private.h" |
8 #include "ppapi/cpp/instance.h" | 8 #include "ppapi/cpp/instance.h" |
9 #include "ppapi/cpp/module.h" | 9 #include "ppapi/cpp/module.h" |
10 #include "ppapi/tests/testing_instance.h" | 10 #include "ppapi/tests/testing_instance.h" |
11 | 11 |
12 REGISTER_TEST_CASE(UMA); | 12 REGISTER_TEST_CASE(UMA); |
13 | 13 |
14 bool TestUMA::Init() { | 14 bool TestUMA::Init() { |
15 uma_interface_ = reinterpret_cast<PPB_UMA_Private const*>( | 15 uma_interface_ = reinterpret_cast<PPB_UMA_Private const*>( |
16 pp::Module::Get()->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE)); | 16 pp::Module::Get()->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE)); |
17 return !!uma_interface_; | 17 return !!uma_interface_; |
18 } | 18 } |
19 | 19 |
20 void TestUMA::RunTest() { | 20 void TestUMA::RunTests(const std::string& filter) { |
21 RUN_TEST(Count); | 21 RUN_TEST(Count, filter); |
22 RUN_TEST(Time); | 22 RUN_TEST(Time, filter); |
23 RUN_TEST(Enum); | 23 RUN_TEST(Enum, filter); |
24 } | 24 } |
25 | 25 |
26 std::string TestUMA::TestCount() { | 26 std::string TestUMA::TestCount() { |
27 pp::Var name_var = pp::Var("Test.CountHistogram"); | 27 pp::Var name_var = pp::Var("Test.CountHistogram"); |
28 PP_Var name = name_var.pp_var(); | 28 PP_Var name = name_var.pp_var(); |
29 uma_interface_->HistogramCustomCounts(name, 10, 1, 100, 50); | 29 uma_interface_->HistogramCustomCounts(name, 10, 1, 100, 50); |
30 uma_interface_->HistogramCustomCounts(name, 30, 1, 100, 50); | 30 uma_interface_->HistogramCustomCounts(name, 30, 1, 100, 50); |
31 uma_interface_->HistogramCustomCounts(name, 20, 1, 100, 50); | 31 uma_interface_->HistogramCustomCounts(name, 20, 1, 100, 50); |
32 uma_interface_->HistogramCustomCounts(name, 40, 1, 100, 50); | 32 uma_interface_->HistogramCustomCounts(name, 40, 1, 100, 50); |
33 PASS(); | 33 PASS(); |
(...skipping 13 matching lines...) Expand all Loading... |
47 pp::Var name_var = pp::Var("Test.EnumHistogram"); | 47 pp::Var name_var = pp::Var("Test.EnumHistogram"); |
48 PP_Var name = name_var.pp_var(); | 48 PP_Var name = name_var.pp_var(); |
49 uma_interface_->HistogramEnumeration(name, 0, 5); | 49 uma_interface_->HistogramEnumeration(name, 0, 5); |
50 uma_interface_->HistogramEnumeration(name, 3, 5); | 50 uma_interface_->HistogramEnumeration(name, 3, 5); |
51 uma_interface_->HistogramEnumeration(name, 3, 5); | 51 uma_interface_->HistogramEnumeration(name, 3, 5); |
52 uma_interface_->HistogramEnumeration(name, 1, 5); | 52 uma_interface_->HistogramEnumeration(name, 1, 5); |
53 uma_interface_->HistogramEnumeration(name, 2, 5); | 53 uma_interface_->HistogramEnumeration(name, 2, 5); |
54 PASS(); | 54 PASS(); |
55 } | 55 } |
56 | 56 |
OLD | NEW |