Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2570)

Unified Diff: chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc

Issue 10536159: Bluetooth Extension API: Add a discovery API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reland Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
index e44592075cd7e2f4cc90269cf1b4b4dcc2081635..30b8ba64c8ac8dfbf6b32ac9190c0ab35d33d7e2 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_apitest_chromeos.cc
@@ -22,13 +22,6 @@ using extensions::Extension;
namespace utils = extension_function_test_utils;
namespace api = extensions::api;
-namespace chromeos {
-
-class BluetoothAdapater;
-
-} // namespace chromeos
-
-
namespace {
class BluetoothApiTest : public PlatformAppApiTest {
@@ -282,3 +275,52 @@ IN_PROC_BROWSER_TEST_F(BluetoothApiTest, SetOutOfBandPairingData) {
// ArrayBuffers in the arguments to the RunFunctionAnd* methods.
// crbug.com/132796
}
+
+IN_PROC_BROWSER_TEST_F(BluetoothApiTest, Discovery) {
+ // TODO(bryeung): test that no events are sent now (crbug.com/132616)
+
+ // Try with a failure to start
+ EXPECT_CALL(*mock_adapter_,
+ SetDiscovering(true,
+ testing::_,
+ testing::Truly(CallClosure)));
+ scoped_refptr<api::BluetoothStartDiscoveryFunction> start_function;
+ start_function = setupFunction(new api::BluetoothStartDiscoveryFunction);
+ std::string error(
+ utils::RunFunctionAndReturnError(start_function, "[]", browser()));
+ ASSERT_TRUE(!error.empty());
+
+ // Reset for a successful start
+ testing::Mock::VerifyAndClearExpectations(mock_adapter_);
+ EXPECT_CALL(*mock_adapter_,
+ SetDiscovering(true,
+ testing::Truly(CallClosure),
+ testing::_));
+
+ start_function = setupFunction(new api::BluetoothStartDiscoveryFunction);
+ (void)utils::RunFunctionAndReturnError(start_function, "[]", browser());
+
+ // TODO(bryeung): test that events are sent now (crbug.com/132616)
+
+ // Reset to try stopping
+ testing::Mock::VerifyAndClearExpectations(mock_adapter_);
+ EXPECT_CALL(*mock_adapter_,
+ SetDiscovering(false,
+ testing::Truly(CallClosure),
+ testing::_));
+ scoped_refptr<api::BluetoothStopDiscoveryFunction> stop_function;
+ stop_function = setupFunction(new api::BluetoothStopDiscoveryFunction);
+ (void)utils::RunFunctionAndReturnResult(stop_function, "[]", browser());
+
+ // TODO(bryeung): test that no events are sent now (crbug.com/132616)
+
+ // Reset to try stopping with an error
+ testing::Mock::VerifyAndClearExpectations(mock_adapter_);
+ EXPECT_CALL(*mock_adapter_,
+ SetDiscovering(false,
+ testing::_,
+ testing::Truly(CallClosure)));
+ stop_function = setupFunction(new api::BluetoothStopDiscoveryFunction);
+ error = utils::RunFunctionAndReturnError(stop_function, "[]", browser());
+ ASSERT_TRUE(!error.empty());
+}
« no previous file with comments | « chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.cc ('k') | chrome/browser/extensions/extension_event_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698