| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "content/common/plugin_list.h" | 5 #include "content/common/plugin_list.h" |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 GURL target_url(kTargetUrl); | 91 GURL target_url(kTargetUrl); |
| 92 std::vector<WebPluginInfo> plugins; | 92 std::vector<WebPluginInfo> plugins; |
| 93 std::vector<std::string> actual_mime_types; | 93 std::vector<std::string> actual_mime_types; |
| 94 | 94 |
| 95 // The file type of the URL is supported by foo_plugin_. However, | 95 // The file type of the URL is supported by foo_plugin_. However, |
| 96 // GetPluginInfoArray should not match foo_plugin_ because the MIME type is | 96 // GetPluginInfoArray should not match foo_plugin_ because the MIME type is |
| 97 // application/octet-stream. | 97 // application/octet-stream. |
| 98 plugin_list_.GetPluginInfoArray(target_url, | 98 plugin_list_.GetPluginInfoArray(target_url, |
| 99 "application/octet-stream", | 99 "application/octet-stream", |
| 100 false, // allow_wildcard | 100 false, // allow_wildcard |
| 101 NULL, // use_stale | 101 nullptr, // use_stale |
| 102 false, // include_npapi | 102 false, // include_npapi |
| 103 &plugins, | 103 &plugins, |
| 104 &actual_mime_types); | 104 &actual_mime_types); |
| 105 EXPECT_EQ(0u, plugins.size()); | 105 EXPECT_EQ(0u, plugins.size()); |
| 106 EXPECT_EQ(0u, actual_mime_types.size()); | 106 EXPECT_EQ(0u, actual_mime_types.size()); |
| 107 | 107 |
| 108 // foo_plugin_ matches due to the MIME type. | 108 // foo_plugin_ matches due to the MIME type. |
| 109 plugins.clear(); | 109 plugins.clear(); |
| 110 actual_mime_types.clear(); | 110 actual_mime_types.clear(); |
| 111 plugin_list_.GetPluginInfoArray(target_url, | 111 plugin_list_.GetPluginInfoArray(target_url, |
| 112 kFooMimeType, | 112 kFooMimeType, |
| 113 false, // allow_wildcard | 113 false, // allow_wildcard |
| 114 NULL, // use_stale | 114 nullptr, // use_stale |
| 115 false, // include_npapi | 115 false, // include_npapi |
| 116 &plugins, | 116 &plugins, |
| 117 &actual_mime_types); | 117 &actual_mime_types); |
| 118 EXPECT_EQ(1u, plugins.size()); | 118 EXPECT_EQ(1u, plugins.size()); |
| 119 EXPECT_TRUE(Contains(plugins, foo_plugin_)); | 119 EXPECT_TRUE(Contains(plugins, foo_plugin_)); |
| 120 ASSERT_EQ(1u, actual_mime_types.size()); | 120 ASSERT_EQ(1u, actual_mime_types.size()); |
| 121 EXPECT_EQ(kFooMimeType, actual_mime_types.front()); | 121 EXPECT_EQ(kFooMimeType, actual_mime_types.front()); |
| 122 | 122 |
| 123 // foo_plugin_ matches due to the file type and empty MIME type. | 123 // foo_plugin_ matches due to the file type and empty MIME type. |
| 124 plugins.clear(); | 124 plugins.clear(); |
| 125 actual_mime_types.clear(); | 125 actual_mime_types.clear(); |
| 126 plugin_list_.GetPluginInfoArray(target_url, | 126 plugin_list_.GetPluginInfoArray(target_url, |
| 127 "", | 127 "", |
| 128 false, // allow_wildcard | 128 false, // allow_wildcard |
| 129 NULL, // use_stale | 129 nullptr, // use_stale |
| 130 false, // include_npapi | 130 false, // include_npapi |
| 131 &plugins, | 131 &plugins, |
| 132 &actual_mime_types); | 132 &actual_mime_types); |
| 133 EXPECT_EQ(1u, plugins.size()); | 133 EXPECT_EQ(1u, plugins.size()); |
| 134 EXPECT_TRUE(Contains(plugins, foo_plugin_)); | 134 EXPECT_TRUE(Contains(plugins, foo_plugin_)); |
| 135 ASSERT_EQ(1u, actual_mime_types.size()); | 135 ASSERT_EQ(1u, actual_mime_types.size()); |
| 136 EXPECT_EQ(kFooMimeType, actual_mime_types.front()); | 136 EXPECT_EQ(kFooMimeType, actual_mime_types.front()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace content | 139 } // namespace content |
| OLD | NEW |