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

Side by Side Diff: chrome/browser/extensions/external_provider_impl_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/external_provider_impl.h" 5 #include "chrome/browser/extensions/external_provider_impl.h"
6 6
7 #include <memory>
7 #include <utility> 8 #include <utility>
8 9
9 #include "base/command_line.h" 10 #include "base/command_line.h"
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/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
16 #include "base/test/scoped_path_override.h" 16 #include "base/test/scoped_path_override.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
19 #include "chrome/browser/extensions/extension_service.h" 19 #include "chrome/browser/extensions/extension_service.h"
20 #include "chrome/browser/extensions/extension_service_test_base.h" 20 #include "chrome/browser/extensions/extension_service_test_base.h"
21 #include "chrome/browser/extensions/updater/extension_cache_fake.h" 21 #include "chrome/browser/extensions/updater/extension_cache_fake.h"
22 #include "chrome/browser/extensions/updater/extension_updater.h" 22 #include "chrome/browser/extensions/updater/extension_updater.h"
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 base::Unretained(this))); 108 base::Unretained(this)));
109 109
110 test_extension_cache_.reset(new ExtensionCacheFake()); 110 test_extension_cache_.reset(new ExtensionCacheFake());
111 111
112 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); 112 base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess();
113 cmdline->AppendSwitchASCII(switches::kAppsGalleryUpdateURL, 113 cmdline->AppendSwitchASCII(switches::kAppsGalleryUpdateURL,
114 test_server_->GetURL(kManifestPath).spec()); 114 test_server_->GetURL(kManifestPath).spec());
115 } 115 }
116 116
117 private: 117 private:
118 scoped_ptr<HttpResponse> HandleRequest(const HttpRequest& request) { 118 std::unique_ptr<HttpResponse> HandleRequest(const HttpRequest& request) {
119 GURL url = test_server_->GetURL(request.relative_url); 119 GURL url = test_server_->GetURL(request.relative_url);
120 if (url.path() == kManifestPath) { 120 if (url.path() == kManifestPath) {
121 scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse); 121 std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse);
122 response->set_code(net::HTTP_OK); 122 response->set_code(net::HTTP_OK);
123 response->set_content(base::StringPrintf( 123 response->set_content(base::StringPrintf(
124 "<?xml version='1.0' encoding='UTF-8'?>\n" 124 "<?xml version='1.0' encoding='UTF-8'?>\n"
125 "<gupdate xmlns='http://www.google.com/update2/response' " 125 "<gupdate xmlns='http://www.google.com/update2/response' "
126 "protocol='2.0'>\n" 126 "protocol='2.0'>\n"
127 " <app appid='%s'>\n" 127 " <app appid='%s'>\n"
128 " <updatecheck codebase='%s' version='1.0' />\n" 128 " <updatecheck codebase='%s' version='1.0' />\n"
129 " </app>\n" 129 " </app>\n"
130 "</gupdate>", 130 "</gupdate>",
131 extension_misc::kInAppPaymentsSupportAppId, 131 extension_misc::kInAppPaymentsSupportAppId,
132 test_server_->GetURL(kAppPath).spec().c_str())); 132 test_server_->GetURL(kAppPath).spec().c_str()));
133 response->set_content_type("text/xml"); 133 response->set_content_type("text/xml");
134 return std::move(response); 134 return std::move(response);
135 } 135 }
136 if (url.path() == kAppPath) { 136 if (url.path() == kAppPath) {
137 base::FilePath test_data_dir; 137 base::FilePath test_data_dir;
138 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir); 138 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
139 std::string contents; 139 std::string contents;
140 base::ReadFileToString( 140 base::ReadFileToString(
141 test_data_dir.AppendASCII("extensions/dummyiap.crx"), 141 test_data_dir.AppendASCII("extensions/dummyiap.crx"),
142 &contents); 142 &contents);
143 scoped_ptr<BasicHttpResponse> response(new BasicHttpResponse); 143 std::unique_ptr<BasicHttpResponse> response(new BasicHttpResponse);
144 response->set_code(net::HTTP_OK); 144 response->set_code(net::HTTP_OK);
145 response->set_content(contents); 145 response->set_content(contents);
146 return std::move(response); 146 return std::move(response);
147 } 147 }
148 148
149 return nullptr; 149 return nullptr;
150 } 150 }
151 151
152 scoped_ptr<EmbeddedTestServer> test_server_; 152 std::unique_ptr<EmbeddedTestServer> test_server_;
153 scoped_ptr<ExtensionCacheFake> test_extension_cache_; 153 std::unique_ptr<ExtensionCacheFake> test_extension_cache_;
154 154
155 #if defined(OS_CHROMEOS) 155 #if defined(OS_CHROMEOS)
156 // chromeos::ServicesCustomizationExternalLoader is hooked up as an 156 // chromeos::ServicesCustomizationExternalLoader is hooked up as an
157 // extensions::ExternalLoader and depends on a functioning StatisticsProvider. 157 // extensions::ExternalLoader and depends on a functioning StatisticsProvider.
158 chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; 158 chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
159 #endif 159 #endif
160 160
161 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImplTest); 161 DISALLOW_COPY_AND_ASSIGN(ExternalProviderImplTest);
162 }; 162 };
163 163
(...skipping 10 matching lines...) Expand all
174 service_->CheckForExternalUpdates(); 174 service_->CheckForExternalUpdates();
175 runner->Run(); 175 runner->Run();
176 176
177 EXPECT_TRUE(service_->GetInstalledExtension( 177 EXPECT_TRUE(service_->GetInstalledExtension(
178 extension_misc::kInAppPaymentsSupportAppId)); 178 extension_misc::kInAppPaymentsSupportAppId));
179 EXPECT_TRUE(service_->IsExtensionEnabled( 179 EXPECT_TRUE(service_->IsExtensionEnabled(
180 extension_misc::kInAppPaymentsSupportAppId)); 180 extension_misc::kInAppPaymentsSupportAppId));
181 } 181 }
182 182
183 } // namespace extensions 183 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698