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

Side by Side Diff: ppapi/tests/test_uma.cc

Issue 6903084: Add UMA private PPAPI interface for UMA logging from NaCl plugin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: merge with HEAD Created 9 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_uma.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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.
4
5 #include "ppapi/tests/test_uma.h"
6
7 #include "ppapi/c/private/ppb_uma_private.h"
8 #include "ppapi/cpp/instance.h"
9 #include "ppapi/cpp/module.h"
10 #include "ppapi/tests/testing_instance.h"
11
12 REGISTER_TEST_CASE(UMA);
13
14 bool TestUMA::Init() {
15 uma_interface_ = reinterpret_cast<PPB_UMA_Private const*>(
16 pp::Module::Get()->GetBrowserInterface(PPB_UMA_PRIVATE_INTERFACE));
17 return !!uma_interface_;
18 }
19
20 void TestUMA::RunTest() {
21 instance_->LogTest("Count", TestCount());
22 instance_->LogTest("Time", TestTime());
23 instance_->LogTest("Enum", TestEnum());
24 }
25
26 std::string TestUMA::TestCount() {
27 pp::Var name_var = pp::Var("Test.CountHistogram");
28 PP_Var name = name_var.pp_var();
29 uma_interface_->HistogramCustomCounts(name, 10, 1, 100, 50);
30 uma_interface_->HistogramCustomCounts(name, 30, 1, 100, 50);
31 uma_interface_->HistogramCustomCounts(name, 20, 1, 100, 50);
32 uma_interface_->HistogramCustomCounts(name, 40, 1, 100, 50);
33 PASS();
34 }
35
36 std::string TestUMA::TestTime() {
37 pp::Var name_var = pp::Var("Test.TimeHistogram");
38 PP_Var name = name_var.pp_var();
39 uma_interface_->HistogramCustomTimes(name, 100, 1, 10000, 50);
40 uma_interface_->HistogramCustomTimes(name, 1000, 1, 10000, 50);
41 uma_interface_->HistogramCustomTimes(name, 5000, 1, 10000, 50);
42 uma_interface_->HistogramCustomTimes(name, 10, 1, 10000, 50);
43 PASS();
44 }
45
46 std::string TestUMA::TestEnum() {
47 pp::Var name_var = pp::Var("Test.EnumHistogram");
48 PP_Var name = name_var.pp_var();
49 uma_interface_->HistogramEnumeration(name, 0, 5);
50 uma_interface_->HistogramEnumeration(name, 3, 5);
51 uma_interface_->HistogramEnumeration(name, 3, 5);
52 uma_interface_->HistogramEnumeration(name, 1, 5);
53 uma_interface_->HistogramEnumeration(name, 2, 5);
54 PASS();
55 }
56
OLDNEW
« no previous file with comments | « ppapi/tests/test_uma.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698