| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 // This file contains browsertests for Web Bluetooth that depend on behavior | 5 // This file contains browsertests for Web Bluetooth that depend on behavior |
| 6 // defined in chrome/, not just in content/. | 6 // defined in chrome/, not just in content/. |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "chrome/browser/permissions/permission_context_base.h" | 10 #include "chrome/browser/permissions/permission_context_base.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 using device::MockBluetoothAdapter; | 24 using device::MockBluetoothAdapter; |
| 25 using testing::Return; | 25 using testing::Return; |
| 26 | 26 |
| 27 typedef testing::NiceMock<MockBluetoothAdapter> NiceMockBluetoothAdapter; | 27 typedef testing::NiceMock<MockBluetoothAdapter> NiceMockBluetoothAdapter; |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 class WebBluetoothTest : public InProcessBrowserTest { | 31 class WebBluetoothTest : public InProcessBrowserTest { |
| 32 protected: | 32 protected: |
| 33 void SetUpCommandLine(base::CommandLine* command_line) override { | 33 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 34 // This is needed while Web Bluetooth is an Origin Trial, but can go away | 34 // TODO(juncai): Remove this switch once Web Bluetooth is supported on Linux |
| 35 // once it ships globally. | 35 // and Windows. |
| 36 command_line->AppendSwitch(switches::kEnableWebBluetooth); | 36 // https://crbug.com/570344 |
| 37 // https://crbug.com/507419 |
| 38 command_line->AppendSwitch( |
| 39 switches::kEnableExperimentalWebPlatformFeatures); |
| 37 InProcessBrowserTest::SetUpCommandLine(command_line); | 40 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 38 } | 41 } |
| 39 | 42 |
| 40 void SetUpOnMainThread() override { | 43 void SetUpOnMainThread() override { |
| 41 // Navigate to a secure context. | 44 // Navigate to a secure context. |
| 42 embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); | 45 embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); |
| 43 ASSERT_TRUE(embedded_test_server()->Start()); | 46 ASSERT_TRUE(embedded_test_server()->Start()); |
| 44 ui_test_utils::NavigateToURL( | 47 ui_test_utils::NavigateToURL( |
| 45 browser(), | 48 browser(), |
| 46 embedded_test_server()->GetURL("localhost", "/simple_page.html")); | 49 embedded_test_server()->GetURL("localhost", "/simple_page.html")); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 " .then(() => { domAutomationController.send('Success'); }," | 163 " .then(() => { domAutomationController.send('Success'); }," |
| 161 " reason => {" | 164 " reason => {" |
| 162 " domAutomationController.send(reason.name + ': ' + reason.message);" | 165 " domAutomationController.send(reason.name + ': ' + reason.message);" |
| 163 " });", | 166 " });", |
| 164 &rejection)); | 167 &rejection)); |
| 165 EXPECT_THAT(rejection, | 168 EXPECT_THAT(rejection, |
| 166 testing::MatchesRegex("SecurityError: .*blacklisted UUID.*")); | 169 testing::MatchesRegex("SecurityError: .*blacklisted UUID.*")); |
| 167 } | 170 } |
| 168 | 171 |
| 169 } // namespace | 172 } // namespace |
| OLD | NEW |