| 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/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" | 9 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" |
| 10 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" | 10 #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 class BluetoothApiTest : public ExtensionApiTest { | 41 class BluetoothApiTest : public ExtensionApiTest { |
| 42 public: | 42 public: |
| 43 BluetoothApiTest() {} | 43 BluetoothApiTest() {} |
| 44 | 44 |
| 45 virtual void SetUpOnMainThread() OVERRIDE { | 45 virtual void SetUpOnMainThread() OVERRIDE { |
| 46 ExtensionApiTest::SetUpOnMainThread(); | 46 ExtensionApiTest::SetUpOnMainThread(); |
| 47 empty_extension_ = utils::CreateEmptyExtension(); | 47 empty_extension_ = utils::CreateEmptyExtension(); |
| 48 SetUpMockAdapter(); | 48 SetUpMockAdapter(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void CleanUpOnMainThread() OVERRIDE { | 51 virtual void TearDownOnMainThread() OVERRIDE { |
| 52 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)); | 52 EXPECT_CALL(*mock_adapter_, RemoveObserver(testing::_)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void SetUpMockAdapter() { | 55 void SetUpMockAdapter() { |
| 56 // The browser will clean this up when it is torn down | 56 // The browser will clean this up when it is torn down |
| 57 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); | 57 mock_adapter_ = new testing::StrictMock<MockBluetoothAdapter>(); |
| 58 event_router()->SetAdapterForTest(mock_adapter_); | 58 event_router()->SetAdapterForTest(mock_adapter_); |
| 59 | 59 |
| 60 device1_.reset(new testing::NiceMock<MockBluetoothDevice>( | 60 device1_.reset(new testing::NiceMock<MockBluetoothDevice>( |
| 61 mock_adapter_, 0, "d1", "11:12:13:14:15:16", | 61 mock_adapter_, 0, "d1", "11:12:13:14:15:16", |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // Load and wait for setup | 450 // Load and wait for setup |
| 451 ExtensionTestMessageListener listener("ready", true); | 451 ExtensionTestMessageListener listener("ready", true); |
| 452 ASSERT_TRUE( | 452 ASSERT_TRUE( |
| 453 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info"))); | 453 LoadExtension(test_data_dir_.AppendASCII("bluetooth/device_info"))); |
| 454 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 454 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 455 | 455 |
| 456 listener.Reply("go"); | 456 listener.Reply("go"); |
| 457 | 457 |
| 458 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 458 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 459 } | 459 } |
| OLD | NEW |