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