Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / extensions / api / streams_private / streams_private_manifest_unittest.cc
blobc30947c1694cc9b2bed740b0b48be1a2645c73ae
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
3 // found in the LICENSE file.
5 #include "base/strings/string_number_conversions.h"
6 #include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
7 #include "extensions/common/constants.h"
8 #include "extensions/common/error_utils.h"
9 #include "extensions/common/extension_builder.h"
10 #include "extensions/common/manifest_constants.h"
11 #include "extensions/common/manifest_handlers/mime_types_handler.h"
12 #include "extensions/common/manifest_url_handlers.h"
13 #include "extensions/common/value_builder.h"
14 #include "testing/gtest/include/gtest/gtest.h"
16 namespace errors = extensions::manifest_errors;
18 using extensions::DictionaryBuilder;
19 using extensions::Extension;
20 using extensions::ExtensionBuilder;
21 using extensions::ListBuilder;
23 namespace {
25 class StreamsPrivateManifestTest : public ChromeManifestTest {
28 TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) {
29 scoped_refptr<const Extension> extension =
30 ExtensionBuilder()
31 .SetID(extension_misc::kQuickOfficeExtensionId)
32 .SetManifest(
33 DictionaryBuilder()
34 .Set("name", "MIME type handler test")
35 .Set("version", "1.0.0")
36 .Set("manifest_version", 2)
37 .Set("mime_types", ListBuilder().Append("text/plain")))
38 .Build();
40 ASSERT_TRUE(extension.get());
41 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension.get());
42 ASSERT_TRUE(handler != NULL);
44 EXPECT_FALSE(handler->CanHandleMIMEType("text/html"));
45 EXPECT_TRUE(handler->CanHandleMIMEType("text/plain"));
48 TEST_F(StreamsPrivateManifestTest,
49 MimeTypesHandlerMIMETypesNotWhitelisted) {
50 scoped_refptr<const Extension> extension =
51 ExtensionBuilder()
52 .SetManifest(
53 DictionaryBuilder()
54 .Set("name", "MIME types test")
55 .Set("version", "1.0.0")
56 .Set("manifest_version", 2)
57 .Set("mime_types", ListBuilder().Append("text/plain")))
58 .Build();
60 ASSERT_TRUE(extension.get());
62 MimeTypesHandler* handler = MimeTypesHandler::GetHandler(extension.get());
63 ASSERT_TRUE(handler == NULL);
66 } // namespace