| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" | 8 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h" |
| 9 #include "extensions/common/constants.h" | 9 #include "extensions/common/constants.h" |
| 10 #include "extensions/common/error_utils.h" | 10 #include "extensions/common/error_utils.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 class StreamsPrivateManifestTest : public ChromeManifestTest { | 27 class StreamsPrivateManifestTest : public ChromeManifestTest { |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) { | 30 TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) { |
| 31 scoped_refptr<const Extension> extension = | 31 scoped_refptr<const Extension> extension = |
| 32 ExtensionBuilder() | 32 ExtensionBuilder() |
| 33 .SetID(extension_misc::kQuickOfficeExtensionId) | 33 .SetID(extension_misc::kQuickOfficeExtensionId) |
| 34 .SetManifest(std::move( | 34 .SetManifest( |
| 35 DictionaryBuilder() | 35 DictionaryBuilder() |
| 36 .Set("name", "MIME type handler test") | 36 .Set("name", "MIME type handler test") |
| 37 .Set("version", "1.0.0") | 37 .Set("version", "1.0.0") |
| 38 .Set("manifest_version", 2) | 38 .Set("manifest_version", 2) |
| 39 .Set("mime_types", | 39 .Set("mime_types", ListBuilder().Append("text/plain").Build()) |
| 40 std::move(ListBuilder().Append("text/plain"))))) | 40 .Build()) |
| 41 .Build(); | 41 .Build(); |
| 42 | 42 |
| 43 ASSERT_TRUE(extension.get()); | 43 ASSERT_TRUE(extension.get()); |
| 44 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension.get()); | 44 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension.get()); |
| 45 ASSERT_TRUE(handler != NULL); | 45 ASSERT_TRUE(handler != NULL); |
| 46 | 46 |
| 47 EXPECT_FALSE(handler->CanHandleMIMEType("text/html")); | 47 EXPECT_FALSE(handler->CanHandleMIMEType("text/html")); |
| 48 EXPECT_TRUE(handler->CanHandleMIMEType("text/plain")); | 48 EXPECT_TRUE(handler->CanHandleMIMEType("text/plain")); |
| 49 } | 49 } |
| 50 | 50 |
| 51 TEST_F(StreamsPrivateManifestTest, | 51 TEST_F(StreamsPrivateManifestTest, |
| 52 MimeTypesHandlerMIMETypesNotWhitelisted) { | 52 MimeTypesHandlerMIMETypesNotWhitelisted) { |
| 53 scoped_refptr<const Extension> extension = | 53 scoped_refptr<const Extension> extension = |
| 54 ExtensionBuilder() | 54 ExtensionBuilder() |
| 55 .SetManifest(std::move( | 55 .SetManifest( |
| 56 DictionaryBuilder() | 56 DictionaryBuilder() |
| 57 .Set("name", "MIME types test") | 57 .Set("name", "MIME types test") |
| 58 .Set("version", "1.0.0") | 58 .Set("version", "1.0.0") |
| 59 .Set("manifest_version", 2) | 59 .Set("manifest_version", 2) |
| 60 .Set("mime_types", | 60 .Set("mime_types", ListBuilder().Append("text/plain").Build()) |
| 61 std::move(ListBuilder().Append("text/plain"))))) | 61 .Build()) |
| 62 .Build(); | 62 .Build(); |
| 63 | 63 |
| 64 ASSERT_TRUE(extension.get()); | 64 ASSERT_TRUE(extension.get()); |
| 65 | 65 |
| 66 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension.get()); | 66 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension.get()); |
| 67 ASSERT_TRUE(handler == NULL); | 67 ASSERT_TRUE(handler == NULL); |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| OLD | NEW |