Move render_view_context_menu.* and related files out of tab_contents.
[chromium-blink-merge.git] / ppapi / tests / test_uma.cc
blobef2100585a93cbca3ab80806f00ebf3381c3b335
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
3 // found in the LICENSE file.
5 #include "ppapi/tests/test_uma.h"
7 #include "ppapi/cpp/instance.h"
8 #include "ppapi/cpp/module.h"
9 #include "ppapi/tests/testing_instance.h"
11 REGISTER_TEST_CASE(UMA);
13 bool TestUMA::Init() {
14 uma_interface_ = static_cast<const PPB_UMA_Private*>(
15 pp::Module::Get()->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE));
16 return !!uma_interface_;
19 void TestUMA::RunTests(const std::string& filter) {
20 RUN_TEST(Count, filter);
21 RUN_TEST(Time, filter);
22 RUN_TEST(Enum, filter);
25 std::string TestUMA::TestCount() {
26 pp::Var name_var = pp::Var("Test.CountHistogram");
27 PP_Var name = name_var.pp_var();
28 PP_Instance instance = instance_->pp_instance();
29 uma_interface_->HistogramCustomCounts(instance, name, 10, 1, 100, 50);
30 uma_interface_->HistogramCustomCounts(instance, name, 30, 1, 100, 50);
31 uma_interface_->HistogramCustomCounts(instance, name, 20, 1, 100, 50);
32 uma_interface_->HistogramCustomCounts(instance, name, 40, 1, 100, 50);
33 PASS();
36 std::string TestUMA::TestTime() {
37 pp::Var name_var = pp::Var("Test.TimeHistogram");
38 PP_Var name = name_var.pp_var();
39 PP_Instance instance = instance_->pp_instance();
40 uma_interface_->HistogramCustomTimes(instance, name, 100, 1, 10000, 50);
41 uma_interface_->HistogramCustomTimes(instance, name, 1000, 1, 10000, 50);
42 uma_interface_->HistogramCustomTimes(instance, name, 5000, 1, 10000, 50);
43 uma_interface_->HistogramCustomTimes(instance, name, 10, 1, 10000, 50);
44 PASS();
47 std::string TestUMA::TestEnum() {
48 pp::Var name_var = pp::Var("Test.EnumHistogram");
49 PP_Var name = name_var.pp_var();
50 PP_Instance instance = instance_->pp_instance();
51 uma_interface_->HistogramEnumeration(instance, name, 0, 5);
52 uma_interface_->HistogramEnumeration(instance, name, 3, 5);
53 uma_interface_->HistogramEnumeration(instance, name, 3, 5);
54 uma_interface_->HistogramEnumeration(instance, name, 1, 5);
55 uma_interface_->HistogramEnumeration(instance, name, 2, 5);
56 PASS();