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

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: 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
« no previous file with comments | « no previous file | extensions/browser/api/file_handlers/mime_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 68f9a1d7dda3dd292d86a2e626279302bb3bbf16..ffbfe3056647ee3b434b407ddc24c929a73328cd 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/message_loop/message_loop.h"
#include "base/run_loop.h"
@@ -42,8 +43,12 @@ class BluetoothEventRouterTest : public ExtensionsTest {
public:
BluetoothEventRouterTest()
: ui_thread_(content::BrowserThread::UI, &message_loop_),
- mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()),
- router_(new BluetoothEventRouter(browser_context())) {
+ mock_adapter_(new testing::StrictMock<device::MockBluetoothAdapter>()) {
karandeepb 2017/04/06 03:29:24 Seems this is leaked. Intentional?
+ }
+
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698