| 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 "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/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 // Load and wait for setup | 493 // Load and wait for setup |
| 494 ExtensionTestMessageListener listener("ready", true); | 494 ExtensionTestMessageListener listener("ready", true); |
| 495 scoped_refptr<const Extension> extension( | 495 scoped_refptr<const Extension> extension( |
| 496 LoadExtension(test_data_dir_.AppendASCII("bluetooth/on_connection"))); | 496 LoadExtension(test_data_dir_.AppendASCII("bluetooth/on_connection"))); |
| 497 ASSERT_TRUE(extension.get()); | 497 ASSERT_TRUE(extension.get()); |
| 498 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 498 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 499 | 499 |
| 500 scoped_refptr<device::MockBluetoothSocket> socket = | 500 scoped_refptr<device::MockBluetoothSocket> socket = |
| 501 new device::MockBluetoothSocket(); | 501 new device::MockBluetoothSocket(); |
| 502 | 502 |
| 503 event_router()->AddProfile("1234", profile1_.get()); | 503 event_router()->AddProfile("1234", extension->id(), profile1_.get()); |
| 504 event_router()->DispatchConnectionEvent( | 504 event_router()->DispatchConnectionEvent( |
| 505 extension->id(), "1234", device1_.get(), socket); | 505 extension->id(), "1234", device1_.get(), socket); |
| 506 | 506 |
| 507 listener.Reply("go"); | 507 listener.Reply("go"); |
| 508 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 508 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 509 event_router()->RemoveProfile("1234"); | 509 event_router()->RemoveProfile("1234"); |
| 510 } | 510 } |
| 511 | 511 |
| 512 IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetProfiles) { | 512 IN_PROC_BROWSER_TEST_F(BluetoothApiTest, GetProfiles) { |
| 513 ResultCatcher catcher; | 513 ResultCatcher catcher; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 // Load and wait for setup | 570 // Load and wait for setup |
| 571 ExtensionTestMessageListener listener("ready", true); | 571 ExtensionTestMessageListener listener("ready", true); |
| 572 ASSERT_TRUE(LoadExtension( | 572 ASSERT_TRUE(LoadExtension( |
| 573 test_data_dir_.AppendASCII("bluetooth/get_devices_error"))); | 573 test_data_dir_.AppendASCII("bluetooth/get_devices_error"))); |
| 574 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 574 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 575 | 575 |
| 576 listener.Reply("go"); | 576 listener.Reply("go"); |
| 577 | 577 |
| 578 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 578 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 579 } | 579 } |
| OLD | NEW |