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

Side by Side Diff: chrome/browser/metrics/metrics_service_unittest.cc

Issue 9702015: [UMA] Add performance profile data to UMA uploads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add tests Created 8 years, 8 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
OLDNEW
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 "chrome/browser/metrics/metrics_service.h"
6 5
6 #include <ctype.h>
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "chrome/browser/metrics/metrics_service.h"
10
11 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
12 11
13 class MetricsServiceTest : public ::testing::Test {
14 };
15
16 // Ensure the ClientId is formatted as expected. 12 // Ensure the ClientId is formatted as expected.
17 TEST(MetricsServiceTest, ClientIdCorrectlyFormatted) { 13 TEST(MetricsServiceTest, ClientIdCorrectlyFormatted) {
18 std::string clientid = MetricsService::GenerateClientID(); 14 std::string clientid = MetricsService::GenerateClientID();
19 EXPECT_EQ(36U, clientid.length()); 15 EXPECT_EQ(36U, clientid.length());
20 std::string hexchars = "0123456789ABCDEF"; 16
21 for (uint32 i = 0; i < clientid.length(); i++) { 17 for (size_t i = 0; i < clientid.length(); ++i) {
22 char current = clientid.at(i); 18 char current = clientid[i];
23 if (i == 8 || i == 13 || i == 18 || i == 23) { 19 if (i == 8 || i == 13 || i == 18 || i == 23)
24 EXPECT_EQ('-', current); 20 EXPECT_EQ('-', current);
25 } else { 21 else
26 EXPECT_TRUE(std::string::npos != hexchars.find(current)); 22 EXPECT_TRUE(isxdigit(current));
27 }
28 } 23 }
29 } 24 }
30 25
31 TEST(MetricsServiceTest, IsPluginProcess) { 26 TEST(MetricsServiceTest, IsPluginProcess) {
32 EXPECT_TRUE( 27 EXPECT_TRUE(
33 MetricsService::IsPluginProcess(content::PROCESS_TYPE_PLUGIN)); 28 MetricsService::IsPluginProcess(content::PROCESS_TYPE_PLUGIN));
34 EXPECT_TRUE( 29 EXPECT_TRUE(
35 MetricsService::IsPluginProcess(content::PROCESS_TYPE_PPAPI_PLUGIN)); 30 MetricsService::IsPluginProcess(content::PROCESS_TYPE_PPAPI_PLUGIN));
36 EXPECT_FALSE( 31 EXPECT_FALSE(
37 MetricsService::IsPluginProcess(content::PROCESS_TYPE_GPU)); 32 MetricsService::IsPluginProcess(content::PROCESS_TYPE_GPU));
38 } 33 }
OLDNEW
« chrome/browser/metrics/metrics_service.cc ('K') | « chrome/browser/metrics/metrics_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698