OLD | NEW |
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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 IN_PROC_BROWSER_TEST_F(BluetoothSocketApiTest, Connect) { | 102 IN_PROC_BROWSER_TEST_F(BluetoothSocketApiTest, Connect) { |
103 ResultCatcher catcher; | 103 ResultCatcher catcher; |
104 catcher.RestrictToBrowserContext(browser()->profile()); | 104 catcher.RestrictToBrowserContext(browser()->profile()); |
105 | 105 |
106 // Return the right mock device object for the address used by the test, | 106 // Return the right mock device object for the address used by the test, |
107 // return NULL for the "Device not found" test. | 107 // return NULL for the "Device not found" test. |
108 EXPECT_CALL(*mock_adapter_.get(), GetDevice(mock_device1_->GetAddress())) | 108 EXPECT_CALL(*mock_adapter_.get(), GetDevice(mock_device1_->GetAddress())) |
109 .WillRepeatedly(testing::Return(mock_device1_.get())); | 109 .WillRepeatedly(testing::Return(mock_device1_.get())); |
110 EXPECT_CALL(*mock_adapter_.get(), GetDevice(std::string("aa:aa:aa:aa:aa:aa"))) | 110 EXPECT_CALL(*mock_adapter_.get(), GetDevice(std::string("aa:aa:aa:aa:aa:aa"))) |
111 .WillOnce(testing::Return(static_cast<BluetoothDevice*>(NULL))); | 111 .WillOnce(testing::Return(static_cast<BluetoothDevice*>(nullptr))); |
112 | 112 |
113 // Return a mock socket object as a successful result to the connect() call. | 113 // Return a mock socket object as a successful result to the connect() call. |
114 BluetoothUUID service_uuid("8e3ad063-db38-4289-aa8f-b30e4223cf40"); | 114 BluetoothUUID service_uuid("8e3ad063-db38-4289-aa8f-b30e4223cf40"); |
115 scoped_refptr<testing::StrictMock<MockBluetoothSocket> > mock_socket | 115 scoped_refptr<testing::StrictMock<MockBluetoothSocket> > mock_socket |
116 = new testing::StrictMock<MockBluetoothSocket>(); | 116 = new testing::StrictMock<MockBluetoothSocket>(); |
117 EXPECT_CALL(*mock_device1_, | 117 EXPECT_CALL(*mock_device1_, |
118 ConnectToService(service_uuid, testing::_, testing::_)) | 118 ConnectToService(service_uuid, testing::_, testing::_)) |
119 .WillOnce(InvokeCallbackArgument<1>(mock_socket)); | 119 .WillOnce(InvokeCallbackArgument<1>(mock_socket)); |
120 | 120 |
121 // Since the socket is unpaused, expect a call to Receive() from the socket | 121 // Since the socket is unpaused, expect a call to Receive() from the socket |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 catcher.RestrictToBrowserContext(browser()->profile()); | 211 catcher.RestrictToBrowserContext(browser()->profile()); |
212 | 212 |
213 // Run the test. | 213 // Run the test. |
214 scoped_refptr<const Extension> extension( | 214 scoped_refptr<const Extension> extension( |
215 LoadExtension(test_data_dir_.AppendASCII( | 215 LoadExtension(test_data_dir_.AppendASCII( |
216 "bluetooth_socket/permission_denied"))); | 216 "bluetooth_socket/permission_denied"))); |
217 ASSERT_TRUE(extension.get()); | 217 ASSERT_TRUE(extension.get()); |
218 | 218 |
219 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 219 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
220 } | 220 } |
OLD | NEW |