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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
6 | 6 |
7 #include "chrome/renderer/plugins/plugin_uma.h" | 7 #include "chrome/renderer/plugins/plugin_uma.h" |
| 8 #include "ppapi/features/features.h" |
8 | 9 |
9 class PluginUMATest : public testing::Test { | 10 class PluginUMATest : public testing::Test { |
10 public: | 11 public: |
11 static void ExpectPluginType( | 12 static void ExpectPluginType( |
12 PluginUMAReporter::PluginType expected_plugin_type, | 13 PluginUMAReporter::PluginType expected_plugin_type, |
13 const std::string& plugin_mime_type, | 14 const std::string& plugin_mime_type, |
14 const GURL& plugin_src) { | 15 const GURL& plugin_src) { |
15 EXPECT_EQ(expected_plugin_type, | 16 EXPECT_EQ(expected_plugin_type, |
16 PluginUMAReporter::GetInstance()->GetPluginType(plugin_mime_type, | 17 PluginUMAReporter::GetInstance()->GetPluginType(plugin_mime_type, |
17 plugin_src)); | 18 plugin_src)); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 GURL("some url")); | 97 GURL("some url")); |
97 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, | 98 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, |
98 "application/x-futuresplash", | 99 "application/x-futuresplash", |
99 GURL("some url")); | 100 GURL("some url")); |
100 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, | 101 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, |
101 "application/shockwave-flash", | 102 "application/shockwave-flash", |
102 GURL("some url")); | 103 GURL("some url")); |
103 } | 104 } |
104 | 105 |
105 TEST_F(PluginUMATest, WidevineCdm) { | 106 TEST_F(PluginUMATest, WidevineCdm) { |
106 #if defined(ENABLE_PEPPER_CDMS) | 107 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
107 ExpectPluginType(PluginUMAReporter::WIDEVINE_CDM, | 108 ExpectPluginType(PluginUMAReporter::WIDEVINE_CDM, |
108 #else | 109 #else |
109 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, | 110 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, |
110 #endif | 111 #endif |
111 "application/x-ppapi-widevine-cdm", | 112 "application/x-ppapi-widevine-cdm", |
112 GURL("some url")); | 113 GURL("some url")); |
113 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, | 114 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, |
114 "application/x-ppapi-widevine-cdm-sufix", | 115 "application/x-ppapi-widevine-cdm-sufix", |
115 GURL("some url")); | 116 GURL("some url")); |
116 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, | 117 ExpectPluginType(PluginUMAReporter::UNSUPPORTED_MIMETYPE, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 ExpectPluginType( | 154 ExpectPluginType( |
154 PluginUMAReporter::UNSUPPORTED_EXTENSION, std::string(), GURL("mov")); | 155 PluginUMAReporter::UNSUPPORTED_EXTENSION, std::string(), GURL("mov")); |
155 } | 156 } |
156 | 157 |
157 TEST_F(PluginUMATest, CaseSensitivity) { | 158 TEST_F(PluginUMATest, CaseSensitivity) { |
158 ExpectPluginType( | 159 ExpectPluginType( |
159 PluginUMAReporter::QUICKTIME, "video/QUICKTIME", GURL("http://file.aaa")); | 160 PluginUMAReporter::QUICKTIME, "video/QUICKTIME", GURL("http://file.aaa")); |
160 ExpectPluginType( | 161 ExpectPluginType( |
161 PluginUMAReporter::QUICKTIME, std::string(), GURL("http://file.MoV")); | 162 PluginUMAReporter::QUICKTIME, std::string(), GURL("http://file.MoV")); |
162 } | 163 } |
OLD | NEW |