OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" | 8 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" |
9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" | 9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" |
10 #include "chrome/browser/extensions/api/permissions/permissions_api.h" | 10 #include "chrome/browser/extensions/api/permissions/permissions_api.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 virtual void CleanUpOnMainThread() OVERRIDE { | 53 virtual void CleanUpOnMainThread() OVERRIDE { |
54 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)); | 54 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)); |
55 } | 55 } |
56 | 56 |
57 void SetUpMockAdapter() { | 57 void SetUpMockAdapter() { |
58 // The browser will clean this up when it is torn down | 58 // The browser will clean this up when it is torn down |
59 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); | 59 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); |
60 event_router()->SetAdapterForTest(mock_adapter_); | 60 event_router()->SetAdapterForTest(mock_adapter_); |
61 | 61 |
62 device1_.reset(new testing::NiceMock<MockBluetoothDevice>( | 62 device1_.reset(new testing::NiceMock<MockBluetoothDevice>( |
63 mock_adapter_, "d1", "11:12:13:14:15:16", | 63 mock_adapter_, 0, "d1", "11:12:13:14:15:16", |
64 true /* paired */, false /* bonded */, true /* connected */)); | 64 true /* paired */, true /* connected */)); |
65 device2_.reset(new testing::NiceMock<MockBluetoothDevice>( | 65 device2_.reset(new testing::NiceMock<MockBluetoothDevice>( |
66 mock_adapter_, "d2", "21:22:23:24:25:26", | 66 mock_adapter_, 0, "d2", "21:22:23:24:25:26", |
67 false /* paired */, true /* bonded */, false /* connected */)); | 67 false /* paired */, false /* connected */)); |
68 } | 68 } |
69 | 69 |
70 template <class T> | 70 template <class T> |
71 T* setupFunction(T* function) { | 71 T* setupFunction(T* function) { |
72 function->set_extension(empty_extension_.get()); | 72 function->set_extension(empty_extension_.get()); |
73 function->set_has_callback(true); | 73 function->set_has_callback(true); |
74 return function; | 74 return function; |
75 } | 75 } |
76 | 76 |
77 protected: | 77 protected: |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); | 491 PermissionsRequestFunction::SetIgnoreUserGestureForTests(true); |
492 | 492 |
493 EXPECT_CALL(*mock_adapter_, GetDevice(device1_->address())) | 493 EXPECT_CALL(*mock_adapter_, GetDevice(device1_->address())) |
494 .WillOnce(testing::Return(device1_.get())); | 494 .WillOnce(testing::Return(device1_.get())); |
495 EXPECT_CALL(*device1_, | 495 EXPECT_CALL(*device1_, |
496 ConnectToService(testing::_, testing::_)) | 496 ConnectToService(testing::_, testing::_)) |
497 .WillOnce(testing::Invoke(CallConnectToServiceCallback)); | 497 .WillOnce(testing::Invoke(CallConnectToServiceCallback)); |
498 | 498 |
499 EXPECT_TRUE(RunExtensionTest("bluetooth/permissions")) << message_; | 499 EXPECT_TRUE(RunExtensionTest("bluetooth/permissions")) << message_; |
500 } | 500 } |
OLD | NEW |