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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.h

Issue 1132943002: bluetooth: Move mock creation out of BluetoothDispatcherHost to LayoutTestBluetoothAdapterProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-testing-layout-tests
Patch Set: Fix API tests failing Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_dispatcher_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "content/common/bluetooth/bluetooth_error.h" 10 #include "content/common/bluetooth/bluetooth_error.h"
(...skipping 16 matching lines...) Expand all
27 : public BrowserMessageFilter, 27 : public BrowserMessageFilter,
28 public device::BluetoothAdapter::Observer { 28 public device::BluetoothAdapter::Observer {
29 public: 29 public:
30 BluetoothDispatcherHost(); 30 BluetoothDispatcherHost();
31 // BrowserMessageFilter: 31 // BrowserMessageFilter:
32 void OnDestruct() const override; 32 void OnDestruct() const override;
33 void OverrideThreadForMessage(const IPC::Message& message, 33 void OverrideThreadForMessage(const IPC::Message& message,
34 BrowserThread::ID* thread) override; 34 BrowserThread::ID* thread) override;
35 bool OnMessageReceived(const IPC::Message& message) override; 35 bool OnMessageReceived(const IPC::Message& message) override;
36 36
37 void SetBluetoothAdapterForTesting(const std::string& name); 37 void SetBluetoothAdapterForTesting(
38 scoped_refptr<device::BluetoothAdapter> mock_adapter);
38 39
39 protected: 40 protected:
40 ~BluetoothDispatcherHost() override; 41 ~BluetoothDispatcherHost() override;
41 42
42 private: 43 private:
43 friend class base::DeleteHelper<BluetoothDispatcherHost>; 44 friend class base::DeleteHelper<BluetoothDispatcherHost>;
44 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 45 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
45 46
46 // Set |adapter_| to a BluetoothAdapter instance and register observers, 47 // Set |adapter_| to a BluetoothAdapter instance and register observers,
47 // releasing references to previous |adapter_|. 48 // releasing references to previous |adapter_|.
(...skipping 14 matching lines...) Expand all
62 // Stop in progress discovery session. 63 // Stop in progress discovery session.
63 void StopDiscoverySession( 64 void StopDiscoverySession(
64 int thread_id, 65 int thread_id,
65 int request_id, 66 int request_id,
66 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); 67 scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
67 68
68 // Callbacks for BluetoothDiscoverySession::Stop. 69 // Callbacks for BluetoothDiscoverySession::Stop.
69 void OnDiscoverySessionStopped(int thread_id, int request_id); 70 void OnDiscoverySessionStopped(int thread_id, int request_id);
70 void OnDiscoverySessionStoppedError(int thread_id, int request_id); 71 void OnDiscoverySessionStoppedError(int thread_id, int request_id);
71 72
73 // Defines how long to scan for.
74 int current_scan_time_;
75
72 // A BluetoothAdapter instance representing an adapter of the system. 76 // A BluetoothAdapter instance representing an adapter of the system.
73 scoped_refptr<device::BluetoothAdapter> adapter_; 77 scoped_refptr<device::BluetoothAdapter> adapter_;
74 78
75 enum class MockData { NOT_MOCKING, REJECT, RESOLVE };
76 MockData bluetooth_mock_data_set_;
77 BluetoothError bluetooth_request_device_reject_type_;
78
79 // Must be last member, see base/memory/weak_ptr.h documentation 79 // Must be last member, see base/memory/weak_ptr.h documentation
80 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; 80 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_;
81 81
82 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); 82 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost);
83 }; 83 };
84 84
85 } // namespace content 85 } // namespace content
86 86
87 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 87 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698