| OLD | NEW |
| 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/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 14 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/extensions/extension_apitest.h" | 15 #include "chrome/browser/extensions/extension_apitest.h" |
| 15 #include "chrome/browser/lifetime/keep_alive_types.h" | 16 #include "chrome/browser/lifetime/keep_alive_types.h" |
| 16 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 17 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
| 17 #include "chrome/browser/net/prediction_options.h" | 18 #include "chrome/browser/net/prediction_options.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // sure it's not the last one, so the message loop doesn't quit | 88 // sure it's not the last one, so the message loop doesn't quit |
| 88 // unexpectedly. | 89 // unexpectedly. |
| 89 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::BROWSER, | 90 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::BROWSER, |
| 90 KeepAliveRestartOption::DISABLED)); | 91 KeepAliveRestartOption::DISABLED)); |
| 91 } | 92 } |
| 92 | 93 |
| 93 void TearDownOnMainThread() override { | 94 void TearDownOnMainThread() override { |
| 94 // BrowserProcess::Shutdown() needs to be called in a message loop, so we | 95 // BrowserProcess::Shutdown() needs to be called in a message loop, so we |
| 95 // post a task to release the keep alive, then run the message loop. | 96 // post a task to release the keep alive, then run the message loop. |
| 96 base::ThreadTaskRunnerHandle::Get()->PostTask( | 97 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 97 FROM_HERE, base::Bind(&scoped_ptr<ScopedKeepAlive>::reset, | 98 FROM_HERE, base::Bind(&std::unique_ptr<ScopedKeepAlive>::reset, |
| 98 base::Unretained(&keep_alive_), nullptr)); | 99 base::Unretained(&keep_alive_), nullptr)); |
| 99 content::RunAllPendingInMessageLoop(); | 100 content::RunAllPendingInMessageLoop(); |
| 100 | 101 |
| 101 ExtensionApiTest::TearDownOnMainThread(); | 102 ExtensionApiTest::TearDownOnMainThread(); |
| 102 } | 103 } |
| 103 | 104 |
| 104 Profile* profile_; | 105 Profile* profile_; |
| 105 scoped_ptr<ScopedKeepAlive> keep_alive_; | 106 std::unique_ptr<ScopedKeepAlive> keep_alive_; |
| 106 }; | 107 }; |
| 107 | 108 |
| 108 // http://crbug.com/177163 | 109 // http://crbug.com/177163 |
| 109 #if defined(OS_WIN) && !defined(NDEBUG) | 110 #if defined(OS_WIN) && !defined(NDEBUG) |
| 110 #define MAYBE_Standard DISABLED_Standard | 111 #define MAYBE_Standard DISABLED_Standard |
| 111 #else | 112 #else |
| 112 #define MAYBE_Standard Standard | 113 #define MAYBE_Standard Standard |
| 113 #endif | 114 #endif |
| 114 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, MAYBE_Standard) { | 115 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, MAYBE_Standard) { |
| 115 PrefService* prefs = profile_->GetPrefs(); | 116 PrefService* prefs = profile_->GetPrefs(); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 listener_incognito10.Reply("ok"); | 342 listener_incognito10.Reply("ok"); |
| 342 | 343 |
| 343 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 344 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 344 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); | 345 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); |
| 345 } | 346 } |
| 346 | 347 |
| 347 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, DataReductionProxy) { | 348 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, DataReductionProxy) { |
| 348 EXPECT_TRUE(RunExtensionTest("preference/data_reduction_proxy")) << | 349 EXPECT_TRUE(RunExtensionTest("preference/data_reduction_proxy")) << |
| 349 message_; | 350 message_; |
| 350 } | 351 } |
| OLD | NEW |