| 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 27 matching lines...) Expand all Loading... |
| 38 class BluetoothSocketApiTest : public ExtensionApiTest { | 38 class BluetoothSocketApiTest : public ExtensionApiTest { |
| 39 public: | 39 public: |
| 40 BluetoothSocketApiTest() {} | 40 BluetoothSocketApiTest() {} |
| 41 | 41 |
| 42 virtual void SetUpOnMainThread() OVERRIDE { | 42 virtual void SetUpOnMainThread() OVERRIDE { |
| 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 virtual void CleanUpOnMainThread() OVERRIDE { | |
| 49 ExtensionApiTest::CleanUpOnMainThread(); | |
| 50 } | |
| 51 | |
| 52 void SetUpMockAdapter() { | 48 void SetUpMockAdapter() { |
| 53 // The browser will clean this up when it is torn down. | 49 // The browser will clean this up when it is torn down. |
| 54 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); | 50 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); |
| 55 BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_); | 51 BluetoothAdapterFactory::SetAdapterForTesting(mock_adapter_); |
| 56 | 52 |
| 57 mock_device1_.reset(new testing::NiceMock<MockBluetoothDevice>( | 53 mock_device1_.reset(new testing::NiceMock<MockBluetoothDevice>( |
| 58 mock_adapter_, 0, "d1", "11:12:13:14:15:16", | 54 mock_adapter_, 0, "d1", "11:12:13:14:15:16", |
| 59 true /* paired */, false /* connected */)); | 55 true /* paired */, false /* connected */)); |
| 60 mock_device2_.reset(new testing::NiceMock<MockBluetoothDevice>( | 56 mock_device2_.reset(new testing::NiceMock<MockBluetoothDevice>( |
| 61 mock_adapter_, 0, "d2", "21:22:23:24:25:26", | 57 mock_adapter_, 0, "d2", "21:22:23:24:25:26", |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 catcher.RestrictToProfile(browser()->profile()); | 196 catcher.RestrictToProfile(browser()->profile()); |
| 201 | 197 |
| 202 // Run the test. | 198 // Run the test. |
| 203 scoped_refptr<const Extension> extension( | 199 scoped_refptr<const Extension> extension( |
| 204 LoadExtension(test_data_dir_.AppendASCII( | 200 LoadExtension(test_data_dir_.AppendASCII( |
| 205 "bluetooth_socket/permission_denied"))); | 201 "bluetooth_socket/permission_denied"))); |
| 206 ASSERT_TRUE(extension.get()); | 202 ASSERT_TRUE(extension.get()); |
| 207 | 203 |
| 208 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 204 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 209 } | 205 } |
| OLD | NEW |