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

Side by Side Diff: extensions/browser/api/bluetooth/bluetooth_private_apitest.cc

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 years, 6 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
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 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" 9 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
10 #include "device/bluetooth/test/mock_bluetooth_device.h" 10 #include "device/bluetooth/test/mock_bluetooth_device.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void DispatchPairingEvent(bt_private::PairingEventType pairing_event_type) { 94 void DispatchPairingEvent(bt_private::PairingEventType pairing_event_type) {
95 bt_private::PairingEvent pairing_event; 95 bt_private::PairingEvent pairing_event;
96 pairing_event.pairing = pairing_event_type; 96 pairing_event.pairing = pairing_event_type;
97 pairing_event.device.name.reset(new std::string(kDeviceName)); 97 pairing_event.device.name.reset(new std::string(kDeviceName));
98 pairing_event.device.address = mock_device_->GetAddress(); 98 pairing_event.device.address = mock_device_->GetAddress();
99 pairing_event.device.vendor_id_source = bt::VENDOR_ID_SOURCE_USB; 99 pairing_event.device.vendor_id_source = bt::VENDOR_ID_SOURCE_USB;
100 pairing_event.device.type = bt::DEVICE_TYPE_PHONE; 100 pairing_event.device.type = bt::DEVICE_TYPE_PHONE;
101 101
102 scoped_ptr<base::ListValue> args = 102 scoped_ptr<base::ListValue> args =
103 bt_private::OnPairing::Create(pairing_event); 103 bt_private::OnPairing::Create(pairing_event);
104 scoped_ptr<Event> event( 104 scoped_ptr<Event> event(new Event(
105 new Event(bt_private::OnPairing::kEventName, args.Pass())); 105 events::UNKNOWN, bt_private::OnPairing::kEventName, args.Pass()));
106 EventRouter::Get(browser()->profile())->DispatchEventToExtension( 106 EventRouter::Get(browser()->profile())->DispatchEventToExtension(
107 kTestExtensionId, event.Pass()); 107 kTestExtensionId, event.Pass());
108 } 108 }
109 109
110 void DispatchAuthorizePairingEvent() { 110 void DispatchAuthorizePairingEvent() {
111 DispatchPairingEvent(bt_private::PAIRING_EVENT_TYPE_REQUESTAUTHORIZATION); 111 DispatchPairingEvent(bt_private::PAIRING_EVENT_TYPE_REQUESTAUTHORIZATION);
112 } 112 }
113 113
114 void DispatchPincodePairingEvent() { 114 void DispatchPincodePairingEvent() {
115 DispatchPairingEvent(bt_private::PAIRING_EVENT_TYPE_REQUESTPINCODE); 115 DispatchPairingEvent(bt_private::PAIRING_EVENT_TYPE_REQUESTPINCODE);
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 .WillOnce(Return(true)); 245 .WillOnce(Return(true));
246 EXPECT_CALL(*mock_discovery_session_, 246 EXPECT_CALL(*mock_discovery_session_,
247 SetDiscoveryFilterRaw(Eq(nullptr), _, _)) 247 SetDiscoveryFilterRaw(Eq(nullptr), _, _))
248 .Times(1) 248 .Times(1)
249 .WillOnce(InvokeCallbackArgument<1>()); 249 .WillOnce(InvokeCallbackArgument<1>());
250 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/discovery_filter")) 250 ASSERT_TRUE(RunComponentExtensionTest("bluetooth_private/discovery_filter"))
251 << message_; 251 << message_;
252 } 252 }
253 253
254 } // namespace extensions 254 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698