| 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 #include "content/public/test/browser_test_utils.h" | 5 #include "content/public/test/browser_test_utils.h" |
| 6 #include "content/public/test/content_browser_test.h" | 6 #include "content/public/test/content_browser_test.h" |
| 7 #include "content/public/test/content_browser_test_utils.h" | 7 #include "content/public/test/content_browser_test_utils.h" |
| 8 #include "content/shell/browser/shell.h" | 8 #include "content/shell/browser/shell.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 class MidiBrowserTest : public ContentBrowserTest { | 12 class MidiBrowserTest : public ContentBrowserTest { |
| 13 public: | 13 public: |
| 14 MidiBrowserTest() {} | 14 MidiBrowserTest() {} |
| 15 ~MidiBrowserTest() override {} | 15 ~MidiBrowserTest() override {} |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 IN_PROC_BROWSER_TEST_F(MidiBrowserTest, RequestMIDIAccess) { | 18 IN_PROC_BROWSER_TEST_F(MidiBrowserTest, RequestMIDIAccess) { |
| 19 bool result; | 19 bool result; |
| 20 NavigateToURL(shell(), GURL("about:blank")); | 20 NavigateToURL(shell(), GURL("about:blank")); |
| 21 ASSERT_TRUE(ExecuteScriptAndExtractBool( | 21 ASSERT_TRUE(ExecuteScriptAndExtractBool( |
| 22 shell()->web_contents(), | 22 shell(), |
| 23 "navigator.requestMIDIAccess()" | 23 "navigator.requestMIDIAccess()" |
| 24 " .then(" | 24 " .then(" |
| 25 " _ => domAutomationController.send(true)," | 25 " _ => domAutomationController.send(true)," |
| 26 " _ => domAutomationController.send(false));", | 26 " _ => domAutomationController.send(false));", |
| 27 &result)); | 27 &result)); |
| 28 // We cannot check result since it relies on the availabity of system | 28 // We cannot check result since it relies on the availabity of system |
| 29 // level MIDI on the test runner. | 29 // level MIDI on the test runner. |
| 30 } | 30 } |
| 31 | 31 |
| 32 IN_PROC_BROWSER_TEST_F(MidiBrowserTest, SubscribeAll) { | 32 IN_PROC_BROWSER_TEST_F(MidiBrowserTest, SubscribeAll) { |
| 33 bool result; | 33 bool result; |
| 34 NavigateToURL(shell(), GURL("about:blank")); | 34 NavigateToURL(shell(), GURL("about:blank")); |
| 35 ASSERT_TRUE(ExecuteScriptAndExtractBool( | 35 ASSERT_TRUE(ExecuteScriptAndExtractBool( |
| 36 shell()->web_contents(), | 36 shell(), |
| 37 "navigator.requestMIDIAccess()" | 37 "navigator.requestMIDIAccess()" |
| 38 " .then(" | 38 " .then(" |
| 39 " e => { e.inputs.forEach(i => i.onmidimessage = console.log);" | 39 " e => { e.inputs.forEach(i => i.onmidimessage = console.log);" |
| 40 " domAutomationController.send(true) }," | 40 " domAutomationController.send(true) }," |
| 41 " _ => domAutomationController.send(false));", | 41 " _ => domAutomationController.send(false));", |
| 42 &result)); | 42 &result)); |
| 43 // We cannot check result since it relies on the availabity of system | 43 // We cannot check result since it relies on the availabity of system |
| 44 // level MIDI on the test runner. | 44 // level MIDI on the test runner. |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace content | 47 } // namespace content |
| OLD | NEW |