OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 "chrome/browser/intents/web_intents_reporting.h" | |
6 | |
7 #include <vector> | |
8 | |
9 #include "base/metrics/histogram.h" | |
10 #include "base/metrics/statistics_recorder.h" | |
11 #include "base/utf_string_conversions.h" | |
12 #include "chrome/browser/intents/web_intents_util.h" | |
13 #include "chrome/browser/search_engines/search_engine_type.h" | |
14 #include "testing/gtest/include/gtest/gtest.h" | |
15 | |
16 namespace web_intents { | |
17 namespace reporting { | |
18 namespace { | |
19 | |
20 const char kCustomAction[] = "jiggle"; | |
21 const char kImageType[] = "image/png"; | |
22 const char kCustomType[] = "http://a.b/mine"; | |
23 | |
24 UMABucket ToBucket(const std::string& action, const std::string& type) { | |
25 return web_intents::ToUMABucket( | |
26 ASCIIToUTF16(action), ASCIIToUTF16(type)); | |
27 } | |
28 | |
29 } // namespace | |
30 | |
31 TEST(WebIntentsReportingTest, RecognizedActionAndType) { | |
32 EXPECT_EQ(BUCKET_SHARE_IMAGE, ToBucket(kActionShare, kImageType)); | |
33 } | |
34 | |
35 TEST(WebIntentsReportingTest, CustomAction) { | |
36 EXPECT_EQ(BUCKET_CUSTOM_IMAGE, ToBucket(kCustomAction, kImageType)); | |
37 } | |
38 | |
39 TEST(WebIntentsReportingTest, CustomType) { | |
40 EXPECT_EQ(BUCKET_EDIT_CUSTOM, ToBucket(kActionEdit, kCustomType)); | |
41 } | |
42 | |
43 TEST(WebIntentsReportingTest, CustomActionAndType) { | |
44 EXPECT_EQ(BUCKET_CUSTOM_CUSTOM, ToBucket(kCustomAction, kCustomType)); | |
45 } | |
46 | |
47 } // namespace reporting | |
48 } // namespace web_intents | |
OLD | NEW |