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 command_line->AppendSwitch( |
scheib
2016/10/21 01:02:10
comment as above.
juncai
2016/10/21 16:57:54
Done.
| |
35 // once it ships globally. | 35 switches::kEnableExperimentalWebPlatformFeatures); |
36 command_line->AppendSwitch(switches::kEnableWebBluetooth); | |
37 InProcessBrowserTest::SetUpCommandLine(command_line); | 36 InProcessBrowserTest::SetUpCommandLine(command_line); |
38 } | 37 } |
39 | 38 |
40 void SetUpOnMainThread() override { | 39 void SetUpOnMainThread() override { |
41 // Navigate to a secure context. | 40 // Navigate to a secure context. |
42 embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); | 41 embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data"); |
43 ASSERT_TRUE(embedded_test_server()->Start()); | 42 ASSERT_TRUE(embedded_test_server()->Start()); |
44 ui_test_utils::NavigateToURL( | 43 ui_test_utils::NavigateToURL( |
45 browser(), | 44 browser(), |
46 embedded_test_server()->GetURL("localhost", "/simple_page.html")); | 45 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'); }," | 159 " .then(() => { domAutomationController.send('Success'); }," |
161 " reason => {" | 160 " reason => {" |
162 " domAutomationController.send(reason.name + ': ' + reason.message);" | 161 " domAutomationController.send(reason.name + ': ' + reason.message);" |
163 " });", | 162 " });", |
164 &rejection)); | 163 &rejection)); |
165 EXPECT_THAT(rejection, | 164 EXPECT_THAT(rejection, |
166 testing::MatchesRegex("SecurityError: .*blacklisted UUID.*")); | 165 testing::MatchesRegex("SecurityError: .*blacklisted UUID.*")); |
167 } | 166 } |
168 | 167 |
169 } // namespace | 168 } // namespace |
OLD | NEW |