blob: d3c4ab2f23983b3e53e4def249695884b750b94c [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2021 The Chromium Authors
Caleb Raitto17b55dc2021-02-01 22:28:372// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "build/build_config.h"
6#include "chrome/test/base/chrome_test_utils.h"
Devlin Cronindbf91b22024-08-22 22:35:567#include "chrome/test/base/platform_browser_test.h"
Caleb Raitto17b55dc2021-02-01 22:28:378#include "content/public/test/browser_test.h"
9#include "content/public/test/browser_test_utils.h"
10#include "testing/gtest/include/gtest/gtest.h"
11
Alison Gale079e6e952024-04-16 22:00:3012// TODO(crbug.com/40167066): Investigate why different macOS versions have
Caleb Raitto0c633ff2021-02-02 10:55:2913// different fingerprints.
Xiaohan Wange679bb702022-01-16 01:03:0314#if BUILDFLAG(IS_MAC)
Caleb Raitto0c633ff2021-02-02 10:55:2915#define MAYBE_VerifyDynamicsCompressorFingerprint \
16 DISABLED_VerifyDynamicsCompressorFingerprint
17#else
18#define MAYBE_VerifyDynamicsCompressorFingerprint \
19 VerifyDynamicsCompressorFingerprint
20#endif
21
Caleb Raitto17b55dc2021-02-01 22:28:3722namespace {
23
24// This test runs on Android as well as desktop platforms.
25class WebAudioBrowserTest : public PlatformBrowserTest {
26 public:
27 content::WebContents* web_contents() {
28 return chrome_test_utils::GetActiveWebContents(this);
29 }
30};
31
32IN_PROC_BROWSER_TEST_F(WebAudioBrowserTest,
Caleb Raitto0c633ff2021-02-02 10:55:2933 MAYBE_VerifyDynamicsCompressorFingerprint) {
Caleb Raitto17b55dc2021-02-01 22:28:3734 ASSERT_TRUE(embedded_test_server()->Start());
Colin Blundell8c698602022-05-12 12:13:2335 content::DOMMessageQueue messages(web_contents());
Caleb Raitto17b55dc2021-02-01 22:28:3736 base::RunLoop run_loop;
37
38 ASSERT_TRUE(content::NavigateToURL(
39 web_contents(),
40 embedded_test_server()->GetURL(
41 "/webaudio/calls_dynamics_compressor_fingerprint.html")));
42
43 // The document computes the DynamicsCompressor fingerprint and sends a
44 // message back to the test. Receipt of the message indicates that the script
45 // successfully completed.
46 std::string fingerprint;
47 ASSERT_TRUE(messages.WaitForMessage(&fingerprint));
48
49 // NOTE: Changes to Web Audio code that alter the below fingerprints are
50 // fine, and are cause for updating these expectations -- the issue is if
51 // different devices return different fingerprints.
Caleb Raitto17b55dc2021-02-01 22:28:3752 EXPECT_EQ("13.130926895706125", fingerprint);
Caleb Raitto17b55dc2021-02-01 22:28:3753}
54
55} // namespace