| 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> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // sure it's not the last one, so the message loop doesn't quit | 89 // sure it's not the last one, so the message loop doesn't quit |
| 90 // unexpectedly. | 90 // unexpectedly. |
| 91 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::BROWSER, | 91 keep_alive_.reset(new ScopedKeepAlive(KeepAliveOrigin::BROWSER, |
| 92 KeepAliveRestartOption::DISABLED)); | 92 KeepAliveRestartOption::DISABLED)); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void TearDownOnMainThread() override { | 95 void TearDownOnMainThread() override { |
| 96 // BrowserProcess::Shutdown() needs to be called in a message loop, so we | 96 // BrowserProcess::Shutdown() needs to be called in a message loop, so we |
| 97 // post a task to release the keep alive, then run the message loop. | 97 // post a task to release the keep alive, then run the message loop. |
| 98 base::ThreadTaskRunnerHandle::Get()->PostTask( | 98 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 99 FROM_HERE, base::Bind(&std::unique_ptr<ScopedKeepAlive>::reset, | 99 FROM_HERE, base::BindOnce(&std::unique_ptr<ScopedKeepAlive>::reset, |
| 100 base::Unretained(&keep_alive_), nullptr)); | 100 base::Unretained(&keep_alive_), nullptr)); |
| 101 content::RunAllPendingInMessageLoop(); | 101 content::RunAllPendingInMessageLoop(); |
| 102 | 102 |
| 103 ExtensionApiTest::TearDownOnMainThread(); | 103 ExtensionApiTest::TearDownOnMainThread(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 Profile* profile_; | 106 Profile* profile_; |
| 107 std::unique_ptr<ScopedKeepAlive> keep_alive_; | 107 std::unique_ptr<ScopedKeepAlive> keep_alive_; |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 // http://crbug.com/177163 | 110 // http://crbug.com/177163 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 listener_incognito10.Reply("ok"); | 342 listener_incognito10.Reply("ok"); |
| 343 | 343 |
| 344 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 344 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 345 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); | 345 EXPECT_TRUE(catcher_incognito.GetNextResult()) << catcher.message(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, DataReductionProxy) { | 348 IN_PROC_BROWSER_TEST_F(ExtensionPreferenceApiTest, DataReductionProxy) { |
| 349 EXPECT_TRUE(RunExtensionTest("preference/data_reduction_proxy")) << | 349 EXPECT_TRUE(RunExtensionTest("preference/data_reduction_proxy")) << |
| 350 message_; | 350 message_; |
| 351 } | 351 } |
| OLD | NEW |