Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FarbleGetImageData tests #5603

Merged
merged 1 commit into from
May 21, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions renderer/brave_content_settings_agent_impl_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,13 @@ const char kGetImageDataScript[] =
"canvas.width = 16;"
"canvas.height = 16;"
"var ctx = canvas.getContext('2d');"
"ctx.rect(0, 0, 16, 16);"
"ctx.fillStyle = 'black';"
"ctx.fill();"
"ctx.rect(5, 10, 10, 4);"
"ctx.fillStyle = 'white';"
"ctx.fill();"
"var data = ctx.createImageData(canvas.width, canvas.height);"
"ctx.putImageData(data, 0, 0);"
"domAutomationController.send(ctx.getImageData(0, 0, canvas.width, "
"canvas.height).data.reduce(adder));";

const int kExpectedImageDataHashFarblingBalanced = 261046;
const int kExpectedImageDataHashFarblingOff = 261120;
const int kExpectedImageDataHashFarblingBalanced = 85;
const int kExpectedImageDataHashFarblingOff = 0;
const int kExpectedImageDataHashFarblingMaximum = 127574;

const char kEmptyCookie[] = "";
Expand Down Expand Up @@ -301,16 +297,8 @@ class BraveContentSettingsAgentImplBrowserTest : public InProcessBrowserTest {
base::ScopedTempDir temp_user_data_dir_;
};

// See https://github.com/brave/brave-browser/issues/8937
// Fails on Linux
#if defined(OS_LINUX)
#define MAYBE_FarbleGetImageData DISABLED_FarbleGetImageData
#else
#define MAYBE_FarbleGetImageData FarbleGetImageData
#endif

IN_PROC_BROWSER_TEST_F(BraveContentSettingsAgentImplBrowserTest,
MAYBE_FarbleGetImageData) {
FarbleGetImageData) {
// Farbling should be balanced by default
NavigateToPageWithIframe();
int hash = -1;
Expand Down Expand Up @@ -377,7 +365,7 @@ class BraveContentSettingsAgentImplV2BrowserTest
};

IN_PROC_BROWSER_TEST_F(BraveContentSettingsAgentImplV2BrowserTest,
MAYBE_FarbleGetImageData) {
FarbleGetImageData) {
// Farbling should be default when kBraveFingerprintingV2 is enabled
// because it uses a different content setting
NavigateToPageWithIframe();
Expand Down