blob: ed69c0e74344906aab182f112f60c49900eefd8c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_browser_test.h"
#include "content/public/test/content_browser_test_utils.h"
#include "content/shell/browser/shell.h"
namespace content {
class MidiBrowserTest : public ContentBrowserTest {
public:
MidiBrowserTest() {}
~MidiBrowserTest() override {}
};
IN_PROC_BROWSER_TEST_F(MidiBrowserTest, RequestMIDIAccess) {
bool result;
NavigateToURL(shell(), GURL("about:blank"));
ASSERT_TRUE(ExecuteScriptAndExtractBool(
shell(),
"navigator.requestMIDIAccess()"
" .then("
" _ => domAutomationController.send(true),"
" _ => domAutomationController.send(false));",
&result));
// We cannot check result since it relies on the availabity of system
// level MIDI on the test runner.
}
IN_PROC_BROWSER_TEST_F(MidiBrowserTest, SubscribeAll) {
bool result;
NavigateToURL(shell(), GURL("about:blank"));
ASSERT_TRUE(ExecuteScriptAndExtractBool(
shell(),
"navigator.requestMIDIAccess()"
" .then("
" e => { e.inputs.forEach(i => i.onmidimessage = console.log);"
" domAutomationController.send(true) },"
" _ => domAutomationController.send(false));",
&result));
// We cannot check result since it relies on the availabity of system
// level MIDI on the test runner.
}
} // namespace content
|