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

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

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "extensions/common/manifest_constants.h" 5 #include "extensions/common/manifest_constants.h"
6 #include "extensions/common/manifest_handlers/file_handler_info.h" 6 #include "extensions/common/manifest_handlers/file_handler_info.h"
7 #include "extensions/common/manifest_test.h" 7 #include "extensions/common/manifest_test.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 22 matching lines...) Expand all
33 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR); 33 RunTestcases(testcases, arraysize(testcases), EXPECT_TYPE_ERROR);
34 } 34 }
35 35
36 TEST_F(FileHandlersManifestTest, ValidFileHandlers) { 36 TEST_F(FileHandlersManifestTest, ValidFileHandlers) {
37 scoped_refptr<const Extension> extension = 37 scoped_refptr<const Extension> extension =
38 LoadAndExpectSuccess("file_handlers_valid.json"); 38 LoadAndExpectSuccess("file_handlers_valid.json");
39 39
40 ASSERT_TRUE(extension.get()); 40 ASSERT_TRUE(extension.get());
41 const FileHandlersInfo* handlers = 41 const FileHandlersInfo* handlers =
42 FileHandlers::GetFileHandlers(extension.get()); 42 FileHandlers::GetFileHandlers(extension.get());
43 ASSERT_TRUE(handlers != NULL); 43 ASSERT_TRUE(handlers != nullptr);
44 ASSERT_EQ(2U, handlers->size()); 44 ASSERT_EQ(2U, handlers->size());
45 45
46 FileHandlerInfo handler = handlers->at(0); 46 FileHandlerInfo handler = handlers->at(0);
47 EXPECT_EQ("image", handler.id); 47 EXPECT_EQ("image", handler.id);
48 EXPECT_EQ(1U, handler.types.size()); 48 EXPECT_EQ(1U, handler.types.size());
49 EXPECT_EQ(1U, handler.types.count("image/*")); 49 EXPECT_EQ(1U, handler.types.count("image/*"));
50 EXPECT_EQ(2U, handler.extensions.size()); 50 EXPECT_EQ(2U, handler.extensions.size());
51 EXPECT_EQ(1U, handler.extensions.count(".png")); 51 EXPECT_EQ(1U, handler.extensions.count(".png"));
52 EXPECT_EQ(1U, handler.extensions.count(".gif")); 52 EXPECT_EQ(1U, handler.extensions.count(".gif"));
53 53
54 handler = handlers->at(1); 54 handler = handlers->at(1);
55 EXPECT_EQ("text", handler.id); 55 EXPECT_EQ("text", handler.id);
56 EXPECT_EQ(1U, handler.types.size()); 56 EXPECT_EQ(1U, handler.types.size());
57 EXPECT_EQ(1U, handler.types.count("text/*")); 57 EXPECT_EQ(1U, handler.types.count("text/*"));
58 EXPECT_EQ(0U, handler.extensions.size()); 58 EXPECT_EQ(0U, handler.extensions.size());
59 } 59 }
60 60
61 TEST_F(FileHandlersManifestTest, NotPlatformApp) { 61 TEST_F(FileHandlersManifestTest, NotPlatformApp) {
62 // This should load successfully but have the file handlers ignored. 62 // This should load successfully but have the file handlers ignored.
63 scoped_refptr<const Extension> extension = 63 scoped_refptr<const Extension> extension =
64 LoadAndExpectSuccess("file_handlers_invalid_not_app.json"); 64 LoadAndExpectSuccess("file_handlers_invalid_not_app.json");
65 65
66 ASSERT_TRUE(extension.get()); 66 ASSERT_TRUE(extension.get());
67 const FileHandlersInfo* handlers = 67 const FileHandlersInfo* handlers =
68 FileHandlers::GetFileHandlers(extension.get()); 68 FileHandlers::GetFileHandlers(extension.get());
69 ASSERT_TRUE(handlers == NULL); 69 ASSERT_TRUE(handlers == nullptr);
70 } 70 }
71 71
72 } // namespace extensions 72 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698