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

Unified Diff: extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc

Issue 2802433004: ExtensionsTest: Move initialization to SetUp and avoid potential UAF. (Closed)
Patch Set: Avoid UAF. Created 3 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
index 2b402d5a14d9756d4bd807955b6f453aab0acdec..474a85e663a7ffe44d4aa06f479b77852eef1e06 100644
--- a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
+++ b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc
@@ -8,6 +8,7 @@
#include <string>
#include <utility>
+#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "content/public/test/test_browser_context.h"
@@ -40,8 +41,12 @@ namespace bluetooth = api::bluetooth;
class BluetoothEventRouterTest : public ExtensionsTest {
public:
BluetoothEventRouterTest()
- : mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()),
- router_(new BluetoothEventRouter(browser_context())) {
+ : mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()) {
+ }
+
+ void SetUp() override {
+ ExtensionsTest::SetUp();
+ router_ = base::MakeUnique<BluetoothEventRouter>(browser_context());
router_->SetAdapterForTest(mock_adapter_);
}
« no previous file with comments | « no previous file | extensions/browser/api/file_handlers/mime_util_unittest.cc » ('j') | extensions/browser/extensions_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698