| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ExtensionTestMessageListener listener("ready", true); | 126 ExtensionTestMessageListener listener("ready", true); |
| 127 scoped_refptr<const Extension> extension( | 127 scoped_refptr<const Extension> extension( |
| 128 LoadExtension(test_data_dir_.AppendASCII("bluetooth_socket/connect"))); | 128 LoadExtension(test_data_dir_.AppendASCII("bluetooth_socket/connect"))); |
| 129 ASSERT_TRUE(extension.get()); | 129 ASSERT_TRUE(extension.get()); |
| 130 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 130 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 131 | 131 |
| 132 listener.Reply("go"); | 132 listener.Reply("go"); |
| 133 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 133 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 134 } | 134 } |
| 135 | 135 |
| 136 IN_PROC_BROWSER_TEST_F(BluetoothSocketApiTest, Listen) { | 136 #if defined(_LIBCPP_VERSION) |
| 137 // This test fails in libc++ builds, see http://crbug.com/392205. |
| 138 #define MAYBE_Listen DISABLED_Listen |
| 139 #else |
| 140 #define MAYBE_Listen Listen |
| 141 #endif |
| 142 IN_PROC_BROWSER_TEST_F(BluetoothSocketApiTest, MAYBE_Listen) { |
| 137 ResultCatcher catcher; | 143 ResultCatcher catcher; |
| 138 catcher.RestrictToProfile(browser()->profile()); | 144 catcher.RestrictToProfile(browser()->profile()); |
| 139 | 145 |
| 140 // Return a mock socket object as a successful result to the create service | 146 // Return a mock socket object as a successful result to the create service |
| 141 // call. | 147 // call. |
| 142 BluetoothUUID service_uuid("2de497f9-ab28-49db-b6d2-066ea69f1737"); | 148 BluetoothUUID service_uuid("2de497f9-ab28-49db-b6d2-066ea69f1737"); |
| 143 scoped_refptr<testing::StrictMock<MockBluetoothSocket> > mock_server_socket | 149 scoped_refptr<testing::StrictMock<MockBluetoothSocket> > mock_server_socket |
| 144 = new testing::StrictMock<MockBluetoothSocket>(); | 150 = new testing::StrictMock<MockBluetoothSocket>(); |
| 145 BluetoothAdapter::ServiceOptions service_options; | 151 BluetoothAdapter::ServiceOptions service_options; |
| 146 service_options.name.reset(new std::string("MyServiceName")); | 152 service_options.name.reset(new std::string("MyServiceName")); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 catcher.RestrictToProfile(browser()->profile()); | 206 catcher.RestrictToProfile(browser()->profile()); |
| 201 | 207 |
| 202 // Run the test. | 208 // Run the test. |
| 203 scoped_refptr<const Extension> extension( | 209 scoped_refptr<const Extension> extension( |
| 204 LoadExtension(test_data_dir_.AppendASCII( | 210 LoadExtension(test_data_dir_.AppendASCII( |
| 205 "bluetooth_socket/permission_denied"))); | 211 "bluetooth_socket/permission_denied"))); |
| 206 ASSERT_TRUE(extension.get()); | 212 ASSERT_TRUE(extension.get()); |
| 207 | 213 |
| 208 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 214 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 209 } | 215 } |
| OLD | NEW |