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

Side by Side Diff: chrome/browser/extensions/api/file_handlers/mime_util_unittest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header Created 4 years, 8 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 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 <memory>
7 #include <string> 8 #include <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/test/test_browser_thread_bundle.h" 16 #include "content/public/test/test_browser_thread_bundle.h"
17 #include "content/public/test/test_file_system_context.h" 17 #include "content/public/test/test_file_system_context.h"
18 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace extensions { 21 namespace extensions {
22 namespace app_file_handler_util { 22 namespace app_file_handler_util {
23 namespace { 23 namespace {
24 24
25 const char kOrigin[] = "chrome-extension://cmalghjoncmjoeakimpfhojhpgemgaje"; 25 const char kOrigin[] = "chrome-extension://cmalghjoncmjoeakimpfhojhpgemgaje";
26 const char kJPEGExtensionFilePath[] = "/fake/path/foo.jpg"; 26 const char kJPEGExtensionFilePath[] = "/fake/path/foo.jpg";
27 const char kJPEGExtensionUpperCaseFilePath[] = "/fake/path/FOO.JPG"; 27 const char kJPEGExtensionUpperCaseFilePath[] = "/fake/path/FOO.JPG";
28 28
29 // Saves the returned mime type to a variable. 29 // Saves the returned mime type to a variable.
30 void OnMimeTypeResult(std::string* output, const std::string& mime_type) { 30 void OnMimeTypeResult(std::string* output, const std::string& mime_type) {
31 *output = mime_type; 31 *output = mime_type;
32 } 32 }
33 33
34 // Saves returned mime types to a vector. 34 // Saves returned mime types to a vector.
35 void OnMimeTypesCollected(std::vector<std::string>* output, 35 void OnMimeTypesCollected(
36 scoped_ptr<std::vector<std::string> > mime_types) { 36 std::vector<std::string>* output,
37 std::unique_ptr<std::vector<std::string>> mime_types) {
37 *output = *mime_types; 38 *output = *mime_types;
38 } 39 }
39 40
40 // Creates a native local file system URL for a local path. 41 // Creates a native local file system URL for a local path.
41 storage::FileSystemURL CreateNativeLocalFileSystemURL( 42 storage::FileSystemURL CreateNativeLocalFileSystemURL(
42 storage::FileSystemContext* context, 43 storage::FileSystemContext* context,
43 const base::FilePath local_path) { 44 const base::FilePath local_path) {
44 return context->CreateCrackedFileSystemURL( 45 return context->CreateCrackedFileSystemURL(
45 GURL(kOrigin), storage::kFileSystemTypeNativeLocal, local_path); 46 GURL(kOrigin), storage::kFileSystemTypeNativeLocal, local_path);
46 } 47 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 content::RunAllBlockingPoolTasksUntilIdle(); 140 content::RunAllBlockingPoolTasksUntilIdle();
140 141
141 ASSERT_EQ(3u, result.size()); 142 ASSERT_EQ(3u, result.size());
142 EXPECT_EQ("image/jpeg", result[0]); 143 EXPECT_EQ("image/jpeg", result[0]);
143 EXPECT_EQ("image/jpeg", result[1]); 144 EXPECT_EQ("image/jpeg", result[1]);
144 EXPECT_EQ("text/html", result[2]); 145 EXPECT_EQ("text/html", result[2]);
145 } 146 }
146 147
147 } // namespace app_file_handler_util 148 } // namespace app_file_handler_util
148 } // namespace extensions 149 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/file_handlers/mime_util.cc ('k') | chrome/browser/extensions/api/file_system/file_system_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698