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/api/bluetooth_socket/bluetooth_socket_api.h" | 9 #include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 ExtensionApiTest::SetUpOnMainThread(); | 43 ExtensionApiTest::SetUpOnMainThread(); |
44 empty_extension_ = utils::CreateEmptyExtension(); | 44 empty_extension_ = utils::CreateEmptyExtension(); |
45 SetUpMockAdapter(); | 45 SetUpMockAdapter(); |
46 } | 46 } |
47 | 47 |
48 void SetUpMockAdapter() { | 48 void SetUpMockAdapter() { |
49 // The browser will clean this up when it is torn down. | 49 // The browser will clean this up when it is torn down. |
50 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); | 50 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); |
51 BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_); | 51 BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_); |
52 | 52 |
53 mock_device1_.reset(new testing::NiceMock<MockBluetoothDevice>( | 53 mock_device1_.reset( |
54 mock_adapter_, 0, "d1", "11:12:13:14:15:16", | 54 new testing::NiceMock<MockBluetoothDevice>(mock_adapter_.get(), |
55 true /* paired */, false /* connected */)); | 55 0, |
56 mock_device2_.reset(new testing::NiceMock<MockBluetoothDevice>( | 56 "d1", |
57 mock_adapter_, 0, "d2", "21:22:23:24:25:26", | 57 "11:12:13:14:15:16", |
58 true /* paired */, false /* connected */)); | 58 true /* paired */, |
| 59 false /* connected */)); |
| 60 mock_device2_.reset( |
| 61 new testing::NiceMock<MockBluetoothDevice>(mock_adapter_.get(), |
| 62 0, |
| 63 "d2", |
| 64 "21:22:23:24:25:26", |
| 65 true /* paired */, |
| 66 false /* connected */)); |
59 } | 67 } |
60 | 68 |
61 protected: | 69 protected: |
62 scoped_refptr<testing::StrictMock<MockBluetoothAdapter> > mock_adapter_; | 70 scoped_refptr<testing::StrictMock<MockBluetoothAdapter> > mock_adapter_; |
63 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > mock_device1_; | 71 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > mock_device1_; |
64 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > mock_device2_; | 72 scoped_ptr<testing::NiceMock<MockBluetoothDevice> > mock_device2_; |
65 | 73 |
66 private: | 74 private: |
67 scoped_refptr<Extension> empty_extension_; | 75 scoped_refptr<Extension> empty_extension_; |
68 }; | 76 }; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 catcher.RestrictToProfile(browser()->profile()); | 210 catcher.RestrictToProfile(browser()->profile()); |
203 | 211 |
204 // Run the test. | 212 // Run the test. |
205 scoped_refptr<const Extension> extension( | 213 scoped_refptr<const Extension> extension( |
206 LoadExtension(test_data_dir_.AppendASCII( | 214 LoadExtension(test_data_dir_.AppendASCII( |
207 "bluetooth_socket/permission_denied"))); | 215 "bluetooth_socket/permission_denied"))); |
208 ASSERT_TRUE(extension.get()); | 216 ASSERT_TRUE(extension.get()); |
209 | 217 |
210 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 218 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
211 } | 219 } |
OLD | NEW |