blob: e806ee4ef73f912a409cf53ce5df523ca5166e19 [file] [log] [blame]
Caleb Raitto17b55dc2021-02-01 22:28:371// Copyright 2021 The Chromium Authors. All rights reserved.
2// 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"
7#include "content/public/test/browser_test.h"
8#include "content/public/test/browser_test_utils.h"
9#include "testing/gtest/include/gtest/gtest.h"
10
11#if defined(OS_ANDROID)
12#include "chrome/test/base/android/android_browser_test.h"
13#else
14#include "chrome/test/base/in_process_browser_test.h"
15#endif
16
Caleb Raitto0c633ff2021-02-02 10:55:2917// TODO(crbug.com/1173300): Investigate why different macOS versions have
18// different fingerprints.
19#if defined(OS_MAC)
20#define MAYBE_VerifyDynamicsCompressorFingerprint \
21 DISABLED_VerifyDynamicsCompressorFingerprint
22#else
23#define MAYBE_VerifyDynamicsCompressorFingerprint \
24 VerifyDynamicsCompressorFingerprint
25#endif
26
Caleb Raitto17b55dc2021-02-01 22:28:3727namespace {
28
29// This test runs on Android as well as desktop platforms.
30class WebAudioBrowserTest : public PlatformBrowserTest {
31 public:
32 content::WebContents* web_contents() {
33 return chrome_test_utils::GetActiveWebContents(this);
34 }
35};
36
37IN_PROC_BROWSER_TEST_F(WebAudioBrowserTest,
Caleb Raitto0c633ff2021-02-02 10:55:2938 MAYBE_VerifyDynamicsCompressorFingerprint) {
Caleb Raitto17b55dc2021-02-01 22:28:3739 ASSERT_TRUE(embedded_test_server()->Start());
40 content::DOMMessageQueue messages;
41 base::RunLoop run_loop;
42
43 ASSERT_TRUE(content::NavigateToURL(
44 web_contents(),
45 embedded_test_server()->GetURL(
46 "/webaudio/calls_dynamics_compressor_fingerprint.html")));
47
48 // The document computes the DynamicsCompressor fingerprint and sends a
49 // message back to the test. Receipt of the message indicates that the script
50 // successfully completed.
51 std::string fingerprint;
52 ASSERT_TRUE(messages.WaitForMessage(&fingerprint));
53
54 // NOTE: Changes to Web Audio code that alter the below fingerprints are
55 // fine, and are cause for updating these expectations -- the issue is if
56 // different devices return different fingerprints.
57#if defined(OS_ANDROID) && defined(ARCH_CPU_ARM64)
58 // TODO(crbug.com/1156752): Investigate why this fingerprint is different.
59 EXPECT_EQ("13.13046550525678", fingerprint);
60#else
61 EXPECT_EQ("13.130926895706125", fingerprint);
62#endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARM64)
63}
64
65} // namespace