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/stringprintf.h" | 7 #include "base/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/bluetooth_event_router.h" | 9 #include "chrome/browser/extensions/bluetooth_event_router.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 363 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
364 CloseShellWindowsAndWaitForAppToExit(); | 364 CloseShellWindowsAndWaitForAppToExit(); |
365 } | 365 } |
366 | 366 |
367 IN_PROC_BROWSER_TEST_F(BluetoothApiTest, Events) { | 367 IN_PROC_BROWSER_TEST_F(BluetoothApiTest, Events) { |
368 ResultCatcher catcher; | 368 ResultCatcher catcher; |
369 catcher.RestrictToProfile(browser()->profile()); | 369 catcher.RestrictToProfile(browser()->profile()); |
370 | 370 |
371 // Load and wait for setup | 371 // Load and wait for setup |
372 ExtensionTestMessageListener listener("ready", true); | 372 ExtensionTestMessageListener listener("ready", true); |
| 373 EXPECT_CALL(*mock_adapter_, AddObserver(testing::_)) |
| 374 .WillOnce(testing::Return()); |
373 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("bluetooth/events"))); | 375 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("bluetooth/events"))); |
374 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 376 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
375 | 377 |
376 event_router()->AdapterPoweredChanged(mock_adapter_, true); | 378 event_router()->AdapterPoweredChanged(mock_adapter_, true); |
377 event_router()->AdapterPoweredChanged(mock_adapter_, false); | 379 event_router()->AdapterPoweredChanged(mock_adapter_, false); |
378 event_router()->AdapterPresentChanged(mock_adapter_, true); | 380 event_router()->AdapterPresentChanged(mock_adapter_, true); |
379 event_router()->AdapterPresentChanged(mock_adapter_, false); | 381 event_router()->AdapterPresentChanged(mock_adapter_, false); |
380 event_router()->AdapterDiscoveringChanged(mock_adapter_, true); | 382 event_router()->AdapterDiscoveringChanged(mock_adapter_, true); |
381 event_router()->AdapterDiscoveringChanged(mock_adapter_, false); | 383 event_router()->AdapterDiscoveringChanged(mock_adapter_, false); |
382 | 384 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 ExtensionTestMessageListener listener("ready", true); | 461 ExtensionTestMessageListener listener("ready", true); |
460 ASSERT_TRUE(LoadExtension( | 462 ASSERT_TRUE(LoadExtension( |
461 test_data_dir_.AppendASCII("bluetooth/get_devices_error"))); | 463 test_data_dir_.AppendASCII("bluetooth/get_devices_error"))); |
462 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 464 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
463 | 465 |
464 listener.Reply("go"); | 466 listener.Reply("go"); |
465 | 467 |
466 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 468 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
467 CloseShellWindowsAndWaitForAppToExit(); | 469 CloseShellWindowsAndWaitForAppToExit(); |
468 } | 470 } |
OLD | NEW |