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

Unified Diff: content/shell/browser/layout_test/blink_test_controller.cc

Issue 2658473002: Refactor BluetoothAllowedDevicesMap (Closed)
Patch Set: updated test code Created 3 years, 11 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: content/shell/browser/layout_test/blink_test_controller.cc
diff --git a/content/shell/browser/layout_test/blink_test_controller.cc b/content/shell/browser/layout_test/blink_test_controller.cc
index 46b677d72b04d35984f689e471e6512c80bfa2ca..7110fd9998905cb79dd97a1fd8c88a379f95416d 100644
--- a/content/shell/browser/layout_test/blink_test_controller.cc
+++ b/content/shell/browser/layout_test/blink_test_controller.cc
@@ -23,6 +23,8 @@
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
+#include "content/public/browser/bluetooth_allowed_devices_map_base.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/dom_storage_context.h"
#include "content/public/browser/gpu_data_manager.h"
@@ -415,6 +417,20 @@ std::unique_ptr<BluetoothChooser> BlinkTestController::RunBluetoothChooser(
return base::MakeUnique<LayoutTestFirstDeviceBluetoothChooser>(event_handler);
}
+BluetoothAllowedDevicesMapBase*
+BlinkTestController::GetBluetoothAllowedDevicesMap(
+ BrowserContext* browser_context) {
+ auto iter =
+ browser_contenxt_to_bluetooth_allowed_devices_map_.find(browser_context);
+ if (iter == browser_contenxt_to_bluetooth_allowed_devices_map_.end()) {
+ iter = browser_contenxt_to_bluetooth_allowed_devices_map_.insert(
+ iter,
+ std::make_pair(browser_context,
+ base::MakeUnique<BluetoothAllowedDevicesMapBase>()));
+ }
+ return iter->second.get();
+}
+
bool BlinkTestController::OnMessageReceived(const IPC::Message& message) {
DCHECK(CalledOnValidThread());
bool handled = true;
@@ -449,6 +465,8 @@ bool BlinkTestController::OnMessageReceived(const IPC::Message& message) {
OnGetBluetoothManualChooserEvents)
IPC_MESSAGE_HANDLER(ShellViewHostMsg_SendBluetoothManualChooserEvent,
OnSendBluetoothManualChooserEvent)
+ IPC_MESSAGE_HANDLER(ShellViewHostMsg_ResetBluetoothAllowedDevicesMap,
+ OnResetBluetoothAllowedDevicesMap)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -974,4 +992,8 @@ mojom::LayoutTestControl* BlinkTestController::GetLayoutTestControlPtr(
return layout_test_control_map_[frame].get();
}
+void BlinkTestController::OnResetBluetoothAllowedDevicesMap() {
+ browser_contenxt_to_bluetooth_allowed_devices_map_.clear();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698