Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: extensions/common/manifest_handlers/file_handler_manifest_unittest.cc

Issue 503873002: Remove implicit conversions from scoped_refptr to T* in extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/common/extensions/manifest_tests/extension_manifest_test.h" 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
6 #include "extensions/common/manifest_constants.h" 6 #include "extensions/common/manifest_constants.h"
7 #include "extensions/common/manifest_handlers/file_handler_info.h" 7 #include "extensions/common/manifest_handlers/file_handler_info.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace extensions { 10 namespace extensions {
(...skipping 21 matching lines...) Expand all
32 errors::kInvalidFileHandlersTooManyTypesAndExtensions), 32 errors::kInvalidFileHandlersTooManyTypesAndExtensions),
33 }; 33 };
34 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR); 34 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR);
35 } 35 }
36 36
37 TEST_F(FileHandlersManifestTest, ValidFileHandlers) { 37 TEST_F(FileHandlersManifestTest, ValidFileHandlers) {
38 scoped_refptr<const Extension> extension = 38 scoped_refptr<const Extension> extension =
39 LoadAndExpectSuccess("file_handlers_valid.json"); 39 LoadAndExpectSuccess("file_handlers_valid.json");
40 40
41 ASSERT_TRUE(extension.get()); 41 ASSERT_TRUE(extension.get());
42 const FileHandlersInfo* handlers = FileHandlers::GetFileHandlers(extension); 42 const FileHandlersInfo* handlers =
43 FileHandlers::GetFileHandlers(extension.get());
43 ASSERT_TRUE(handlers != NULL); 44 ASSERT_TRUE(handlers != NULL);
44 ASSERT_EQ(2U, handlers->size()); 45 ASSERT_EQ(2U, handlers->size());
45 46
46 FileHandlerInfo handler = handlers->at(0); 47 FileHandlerInfo handler = handlers->at(0);
47 EXPECT_EQ("image", handler.id); 48 EXPECT_EQ("image", handler.id);
48 EXPECT_EQ(1U, handler.types.size()); 49 EXPECT_EQ(1U, handler.types.size());
49 EXPECT_EQ(1U, handler.types.count("image/*")); 50 EXPECT_EQ(1U, handler.types.count("image/*"));
50 EXPECT_EQ(2U, handler.extensions.size()); 51 EXPECT_EQ(2U, handler.extensions.size());
51 EXPECT_EQ(1U, handler.extensions.count(".png")); 52 EXPECT_EQ(1U, handler.extensions.count(".png"));
52 EXPECT_EQ(1U, handler.extensions.count(".gif")); 53 EXPECT_EQ(1U, handler.extensions.count(".gif"));
53 54
54 handler = handlers->at(1); 55 handler = handlers->at(1);
55 EXPECT_EQ("text", handler.id); 56 EXPECT_EQ("text", handler.id);
56 EXPECT_EQ(1U, handler.types.size()); 57 EXPECT_EQ(1U, handler.types.size());
57 EXPECT_EQ(1U, handler.types.count("text/*")); 58 EXPECT_EQ(1U, handler.types.count("text/*"));
58 EXPECT_EQ(0U, handler.extensions.size()); 59 EXPECT_EQ(0U, handler.extensions.size());
59 } 60 }
60 61
61 TEST_F(FileHandlersManifestTest, NotPlatformApp) { 62 TEST_F(FileHandlersManifestTest, NotPlatformApp) {
62 // This should load successfully but have the file handlers ignored. 63 // This should load successfully but have the file handlers ignored.
63 scoped_refptr<const Extension> extension = 64 scoped_refptr<const Extension> extension =
64 LoadAndExpectSuccess("file_handlers_invalid_not_app.json"); 65 LoadAndExpectSuccess("file_handlers_invalid_not_app.json");
65 66
66 ASSERT_TRUE(extension.get()); 67 ASSERT_TRUE(extension.get());
67 const FileHandlersInfo* handlers = FileHandlers::GetFileHandlers(extension); 68 const FileHandlersInfo* handlers =
69 FileHandlers::GetFileHandlers(extension.get());
68 ASSERT_TRUE(handlers == NULL); 70 ASSERT_TRUE(handlers == NULL);
69 } 71 }
70 72
71 } // namespace extensions 73 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/extension_set_unittest.cc ('k') | extensions/common/permissions/permissions_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698