Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/plugins/navigator-plugins-mimeTypes-comparison.html |
| diff --git a/third_party/WebKit/LayoutTests/plugins/navigator-plugins-mimeTypes-comparison.html b/third_party/WebKit/LayoutTests/plugins/navigator-plugins-mimeTypes-comparison.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1ff5057e128a6740096119fa62a3be32491e6036 |
| --- /dev/null |
| +++ b/third_party/WebKit/LayoutTests/plugins/navigator-plugins-mimeTypes-comparison.html |
| @@ -0,0 +1,39 @@ |
| +<!doctype html> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script> |
| +test(function () { |
| + // Ensure test plugin is loaded |
| + navigator.plugins.refresh(false); |
| + assert_true(navigator.mimeTypes.length != 0); |
|
dominicc (has gone to gerrit)
2016/08/30 02:46:29
Asserting ... > 0 might make the intent clearer.
|
| + assert_true(navigator.plugins.length != 0); |
| + |
| + for (var i = 0; i < navigator.plugins.length; ++i) { |
|
dominicc (has gone to gerrit)
2016/08/30 02:46:29
Maybe i++ is more idiomatic JavaScript?
|
| + // We can only guarantee that the Test Plugin is installed. |
| + if (navigator.plugins[i].name != "Blink Test Plugin") |
|
dominicc (has gone to gerrit)
2016/08/30 02:46:29
There's no particular reason you need the Blink te
|
| + continue; |
| + assert_true(navigator.mimeTypes[i] === navigator.mimeTypes[i]); |
|
dominicc (has gone to gerrit)
2016/08/30 02:46:29
Maybe write a helper, assert_same_object? This wou
Anton Obzhirov
2016/09/01 10:46:37
Actually assert_equals could be used. It additiona
|
| + assert_true(navigator.mimeTypes[navigator.mimeTypes[i].type] === navigator.mimeTypes[i]); |
| + assert_true(navigator.plugins[i] === navigator.plugins[i]); |
| + assert_true(navigator.plugins[navigator.plugins[i].name] === navigator.plugins[i]); |
| + |
| + // Only application/x-blink-test-plugin mimetype is associated with the test plugin. |
| + // It should have the same ordinal as the test plugin in the plugin array. |
| + assert_true(navigator.mimeTypes[i].type == 'application/x-blink-test-plugin'); |
| + assert_true(navigator.mimeTypes['application/x-blink-test-plugin'] === navigator.mimeTypes[i]); |
| + assert_true(navigator.mimeTypes['application/x-blink-test-plugin'].enabledPlugin === navigator.plugins[i]); |
| + assert_true(navigator.plugins[i].item(0) === navigator.mimeTypes[i]); |
| + assert_true(navigator.plugins[i].namedItem('application/x-blink-test-plugin') === navigator.mimeTypes[i]); |
| + } |
| + |
| + // Test that the plugins/mimeTypes DOM objects cache is cleared after refresh. |
| + var plugin = navigator.plugins[0]; |
| + var mimetype = navigator.mimeTypes[0]; |
| + navigator.plugins.refresh(false); |
| + var plugin2 = navigator.plugins[0]; |
| + var mimetype2 = navigator.mimeTypes[0]; |
| + assert_true(plugin !== plugin2); |
| + assert_true(mimetype !== mimetype2); |
| +}, "Test for bug 616662: The mimeTypes and plugins objects on navigator return new objects when indexed by the same ordinal."); |
| +</script> |
| + |