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

Side by Side Diff: chrome/browser/extensions/api/content_settings/content_settings_apitest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <memory>
6
5 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
6 #include "base/location.h" 8 #include "base/location.h"
7 #include "base/memory/scoped_ptr.h"
8 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
9 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
10 #include "base/thread_task_runner_handle.h" 11 #include "base/thread_task_runner_handle.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/content_settings/cookie_settings_factory.h" 14 #include "chrome/browser/content_settings/cookie_settings_factory.h"
14 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 15 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
15 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h" 16 #include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
16 #include "chrome/browser/extensions/extension_apitest.h" 17 #include "chrome/browser/extensions/extension_apitest.h"
17 #include "chrome/browser/lifetime/keep_alive_types.h" 18 #include "chrome/browser/lifetime/keep_alive_types.h"
(...skipping 29 matching lines...) Expand all
47 // sure it's not the last one, so the message loop doesn't quit 48 // sure it's not the last one, so the message loop doesn't quit
48 // unexpectedly. 49 // unexpectedly.
49 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::BROWSER, 50 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::BROWSER,
50 KeepAliveRestartOption::DISABLED)); 51 KeepAliveRestartOption::DISABLED));
51 } 52 }
52 53
53 void TearDownOnMainThread() override { 54 void TearDownOnMainThread() override {
54 // BrowserProcess::Shutdown() needs to be called in a message loop, so we 55 // BrowserProcess::Shutdown() needs to be called in a message loop, so we
55 // post a task to release the keep alive, then run the message loop. 56 // post a task to release the keep alive, then run the message loop.
56 base::ThreadTaskRunnerHandle::Get()->PostTask( 57 base::ThreadTaskRunnerHandle::Get()->PostTask(
57 FROM_HERE, base::Bind(&scoped_ptr<ScopedKeepAlive>::reset, 58 FROM_HERE, base::Bind(&std::unique_ptr<ScopedKeepAlive>::reset,
58 base::Unretained(&keep_alive_), nullptr)); 59 base::Unretained(&keep_alive_), nullptr));
59 content::RunAllPendingInMessageLoop(); 60 content::RunAllPendingInMessageLoop();
60 61
61 ExtensionApiTest::TearDownOnMainThread(); 62 ExtensionApiTest::TearDownOnMainThread();
62 } 63 }
63 64
64 protected: 65 protected:
65 void CheckContentSettingsSet() { 66 void CheckContentSettingsSet() {
66 HostContentSettingsMap* map = 67 HostContentSettingsMap* map =
67 HostContentSettingsMapFactory::GetForProfile(profile_); 68 HostContentSettingsMapFactory::GetForProfile(profile_);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 map->GetContentSetting( 226 map->GetContentSetting(
226 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string())); 227 url, url, CONTENT_SETTINGS_TYPE_PPAPI_BROKER, std::string()));
227 EXPECT_EQ(CONTENT_SETTING_ASK, 228 EXPECT_EQ(CONTENT_SETTING_ASK,
228 map->GetContentSetting( 229 map->GetContentSetting(
229 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, 230 url, url, CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS,
230 std::string())); 231 std::string()));
231 } 232 }
232 233
233 private: 234 private:
234 Profile* profile_; 235 Profile* profile_;
235 scoped_ptr<ScopedKeepAlive> keep_alive_; 236 std::unique_ptr<ScopedKeepAlive> keep_alive_;
236 }; 237 };
237 238
238 // http://crbug.com/177163 239 // http://crbug.com/177163
239 #if defined(OS_WIN) && !defined(NDEBUG) 240 #if defined(OS_WIN) && !defined(NDEBUG)
240 #define MAYBE_Standard DISABLED_Standard 241 #define MAYBE_Standard DISABLED_Standard
241 #else 242 #else
242 #define MAYBE_Standard Standard 243 #define MAYBE_Standard Standard
243 #endif 244 #endif
244 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest, MAYBE_Standard) { 245 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest, MAYBE_Standard) {
245 CheckContentSettingsDefault(); 246 CheckContentSettingsDefault();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 << message_; 293 << message_;
293 } 294 }
294 295
295 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest, 296 IN_PROC_BROWSER_TEST_F(ExtensionContentSettingsApiTest,
296 UnsupportedDefaultSettings) { 297 UnsupportedDefaultSettings) {
297 const char kExtensionPath[] = "content_settings/unsupporteddefaultsettings"; 298 const char kExtensionPath[] = "content_settings/unsupporteddefaultsettings";
298 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_; 299 EXPECT_TRUE(RunExtensionSubtest(kExtensionPath, "test.html")) << message_;
299 } 300 }
300 301
301 } // namespace extensions 302 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698