summaryrefslogtreecommitdiffstats
path: root/content/browser/bluetooth
diff options
context:
space:
mode:
authorleviw <leviw@chromium.org>2015-05-19 17:26:24 -0700
committerCommit bot <commit-bot@chromium.org>2015-05-20 00:26:32 +0000
commit5e096ae82760009e5435785ca7fb2f96b0f0f473 (patch)
tree91354109bee9f5375cd5da5beb51daa357c1c682 /content/browser/bluetooth
parent0b0b636093a7dbb56cc8712e2263b1c9a1ad8079 (diff)
downloadchromium_src-5e096ae82760009e5435785ca7fb2f96b0f0f473.zip
chromium_src-5e096ae82760009e5435785ca7fb2f96b0f0f473.tar.gz
chromium_src-5e096ae82760009e5435785ca7fb2f96b0f0f473.tar.bz2
Revert of bluetooth: Move testing IPC from BluetoothDispatcher to BlinkTestRunner (patchset #2 id:250001 of https://codereview.chromium.org/1125133005/)
Reason for revert: Broke a bunch of Layout Tests. Here's an example: http://test-results.appspot.com/dashboards/flakiness_dashboard.html#showExpectations=true&tests=virtual%2Fstable%2Fanimations-unprefixed%2Fanimation-events-prefixed-04.html STDERR: ==28151==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000050 (pc 0x000006a00bd0 bp 0x7fff171be890 sp 0x7fff171be880 T0) STDERR: #0 0x6a00bcf in content::BluetoothDispatcherHost::SetBluetoothAdapterForTesting(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) content/browser/bluetooth/bluetooth_dispatcher_host.cc:63:43 STDERR: #1 0x4e5d9d in OnSetBluetoothAdapter content/shell/browser/layout_test/layout_test_message_filter.cc:171:3 STDERR: #2 0x4e5d9d in DispatchToMethodImpl<content::LayoutTestMessageFilter, void (content::LayoutTestMessageFilter::*)(const std::__1::basic_string<char> &), std::__1::basic_string<char> , 0> base/tuple.h:252:0 Original issue's description: > bluetooth: Move testing IPC from BluetoothDispatcher to BlinkTestRunner > > This patch removes the testing IPC from BluetoothDispatcher and > BluetoothDispatcherHost. > > This patch also changes the way the mock BluetoothAdapter was set in > BluetoothDispatcherHost. Instead of receiving an IPC to set the adapter, > BluetoothDispatcherHost exposes a function to directly set the adapter. > This function is used by LayoutTestSupport to set the adapter. > > Mock adapter flow before: > BlinkTestRunner -> LayoutTestSupport -> BluetoothDispatcher --IPC--> > BluetoothDispatcherHost (Mock constructed here) > > After: > BlinkTestRunner --IPC--> LayoutTestMessages(Mock constructed here) -> > LayoutTestSupport -> BluetoothDispatcherHost > > This is the first of two patches to remove testing from BluetoothDispatcher > and BluetoothDispatcherHost: > > [1] This patch. > [2] http://crrev.com/1132943002 > > BUG=436284 > > Committed: https://crrev.com/3f7142d0acf5e930743cbe5d754084c464ac3c85 > Cr-Commit-Position: refs/heads/master@{#330647} TBR=jam@chromium.org,scheib@chromium.org,tsepez@chromium.org,ortuno@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=436284 Review URL: https://codereview.chromium.org/1142303002 Cr-Commit-Position: refs/heads/master@{#330653}
Diffstat (limited to 'content/browser/bluetooth')
-rw-r--r--content/browser/bluetooth/bluetooth_dispatcher_host.cc36
-rw-r--r--content/browser/bluetooth/bluetooth_dispatcher_host.h5
2 files changed, 21 insertions, 20 deletions
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
index 6212690..b440cdb 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc
@@ -50,28 +50,13 @@ bool BluetoothDispatcherHost::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(BluetoothDispatcherHost, message)
IPC_MESSAGE_HANDLER(BluetoothHostMsg_RequestDevice, OnRequestDevice)
IPC_MESSAGE_HANDLER(BluetoothHostMsg_ConnectGATT, OnConnectGATT)
+ IPC_MESSAGE_HANDLER(BluetoothHostMsg_SetBluetoothMockDataSetForTesting,
+ OnSetBluetoothMockDataSetForTesting)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
-void BluetoothDispatcherHost::SetBluetoothAdapterForTesting(
- const std::string& name) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- if (name == "RejectRequestDevice_NotFoundError") {
- bluetooth_mock_data_set_ = MockData::REJECT;
- bluetooth_request_device_reject_type_ = BluetoothError::NOT_FOUND;
- } else if (name == "RejectRequestDevice_SecurityError") {
- bluetooth_mock_data_set_ = MockData::REJECT;
- bluetooth_request_device_reject_type_ = BluetoothError::SECURITY;
- } else if (name == "ResolveRequestDevice_Empty" || // TODO(scheib): Remove.
- name == "Single Empty Device") {
- bluetooth_mock_data_set_ = MockData::RESOLVE;
- } else {
- bluetooth_mock_data_set_ = MockData::NOT_MOCKING;
- }
-}
-
BluetoothDispatcherHost::~BluetoothDispatcherHost() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// Clear adapter, releasing observer references.
@@ -150,6 +135,23 @@ void BluetoothDispatcherHost::OnConnectGATT(
device_instance_id));
}
+void BluetoothDispatcherHost::OnSetBluetoothMockDataSetForTesting(
+ const std::string& name) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ if (name == "RejectRequestDevice_NotFoundError") {
+ bluetooth_mock_data_set_ = MockData::REJECT;
+ bluetooth_request_device_reject_type_ = BluetoothError::NOT_FOUND;
+ } else if (name == "RejectRequestDevice_SecurityError") {
+ bluetooth_mock_data_set_ = MockData::REJECT;
+ bluetooth_request_device_reject_type_ = BluetoothError::SECURITY;
+ } else if (name == "ResolveRequestDevice_Empty" || // TODO(scheib): Remove.
+ name == "Single Empty Device") {
+ bluetooth_mock_data_set_ = MockData::RESOLVE;
+ } else {
+ bluetooth_mock_data_set_ = MockData::NOT_MOCKING;
+ }
+}
+
void BluetoothDispatcherHost::OnDiscoverySessionStarted(
int thread_id,
int request_id,
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.h b/content/browser/bluetooth/bluetooth_dispatcher_host.h
index 86aca14..1cc27c5 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.h
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.h
@@ -23,7 +23,7 @@ namespace content {
// UI Thread Note:
// BluetoothDispatcherHost is constructed, operates, and destroyed on the UI
// thread because BluetoothAdapter and related objects live there.
-class CONTENT_EXPORT BluetoothDispatcherHost final
+class BluetoothDispatcherHost final
: public BrowserMessageFilter,
public device::BluetoothAdapter::Observer {
public:
@@ -34,8 +34,6 @@ class CONTENT_EXPORT BluetoothDispatcherHost final
BrowserThread::ID* thread) override;
bool OnMessageReceived(const IPC::Message& message) override;
- void SetBluetoothAdapterForTesting(const std::string& name);
-
protected:
~BluetoothDispatcherHost() override;
@@ -51,6 +49,7 @@ class CONTENT_EXPORT BluetoothDispatcherHost final
void OnRequestDevice(int thread_id, int request_id);
void OnConnectGATT(int thread_id, int request_id,
const std::string& device_instance_id);
+ void OnSetBluetoothMockDataSetForTesting(const std::string& name);
// Callbacks for BluetoothAdapter::StartDiscoverySession.
void OnDiscoverySessionStarted(