OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/extensions/api/file_handlers/mime_util.h" | 5 #include "chrome/browser/extensions/api/file_handlers/mime_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 content::RunAllBlockingPoolTasksUntilIdle(); | 99 content::RunAllBlockingPoolTasksUntilIdle(); |
100 EXPECT_EQ("text/html", result); | 100 EXPECT_EQ("text/html", result); |
101 } | 101 } |
102 } | 102 } |
103 | 103 |
104 TEST_F(FileHandlersMimeUtilTest, MimeTypeCollector_ForURLs) { | 104 TEST_F(FileHandlersMimeUtilTest, MimeTypeCollector_ForURLs) { |
105 MimeTypeCollector collector(&profile_); | 105 MimeTypeCollector collector(&profile_); |
106 | 106 |
107 std::vector<storage::FileSystemURL> urls; | 107 std::vector<storage::FileSystemURL> urls; |
108 urls.push_back(CreateNativeLocalFileSystemURL( | 108 urls.push_back(CreateNativeLocalFileSystemURL( |
109 file_system_context_, | 109 file_system_context_.get(), |
110 base::FilePath::FromUTF8Unsafe(kJPEGExtensionFilePath))); | 110 base::FilePath::FromUTF8Unsafe(kJPEGExtensionFilePath))); |
111 urls.push_back(CreateNativeLocalFileSystemURL( | 111 urls.push_back(CreateNativeLocalFileSystemURL( |
112 file_system_context_, | 112 file_system_context_.get(), |
113 base::FilePath::FromUTF8Unsafe(kJPEGExtensionUpperCaseFilePath))); | 113 base::FilePath::FromUTF8Unsafe(kJPEGExtensionUpperCaseFilePath))); |
114 urls.push_back(CreateNativeLocalFileSystemURL(file_system_context_, | 114 urls.push_back(CreateNativeLocalFileSystemURL(file_system_context_.get(), |
115 html_mime_file_path_)); | 115 html_mime_file_path_)); |
116 | 116 |
117 std::vector<std::string> result; | 117 std::vector<std::string> result; |
118 collector.CollectForURLs(urls, base::Bind(&OnMimeTypesCollected, &result)); | 118 collector.CollectForURLs(urls, base::Bind(&OnMimeTypesCollected, &result)); |
119 content::RunAllBlockingPoolTasksUntilIdle(); | 119 content::RunAllBlockingPoolTasksUntilIdle(); |
120 | 120 |
121 ASSERT_EQ(3u, result.size()); | 121 ASSERT_EQ(3u, result.size()); |
122 EXPECT_EQ("image/jpeg", result[0]); | 122 EXPECT_EQ("image/jpeg", result[0]); |
123 EXPECT_EQ("image/jpeg", result[1]); | 123 EXPECT_EQ("image/jpeg", result[1]); |
124 EXPECT_EQ("text/html", result[2]); | 124 EXPECT_EQ("text/html", result[2]); |
(...skipping 14 matching lines...) Expand all Loading... |
139 content::RunAllBlockingPoolTasksUntilIdle(); | 139 content::RunAllBlockingPoolTasksUntilIdle(); |
140 | 140 |
141 ASSERT_EQ(3u, result.size()); | 141 ASSERT_EQ(3u, result.size()); |
142 EXPECT_EQ("image/jpeg", result[0]); | 142 EXPECT_EQ("image/jpeg", result[0]); |
143 EXPECT_EQ("image/jpeg", result[1]); | 143 EXPECT_EQ("image/jpeg", result[1]); |
144 EXPECT_EQ("text/html", result[2]); | 144 EXPECT_EQ("text/html", result[2]); |
145 } | 145 } |
146 | 146 |
147 } // namespace app_file_handler_util | 147 } // namespace app_file_handler_util |
148 } // namespace extensions | 148 } // namespace extensions |
OLD | NEW |