Skip to content

Commit

Permalink
[network-audit] Add test coverage for the New Tab Page
Browse files Browse the repository at this point in the history
As reported in brave/brave-browser#20501,
the NTP was making outbound requests to ftx.com at startup without
user opt-in, and the network-audit didn't catch that case because
it was NOT loading a NTP as part of the different checks it does
at BraveNetworkAuditTest.BasicTests.

This patch adds explicit test coverage for that case by loading
brave://newtab and waiting 5 minutes, like with the other checks.

Resolves brave/brave-browser#20504
  • Loading branch information
mariospr committed Jan 14, 2022
1 parent 15a1e53 commit 87144bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions browser/net/brave_network_audit_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkAuditTest, BasicTests) {
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("brave://welcome")));
WaitForTimeout(kMaxTimeoutPerLoadedURL);

// Load the NTP to check requests made from the JS widgets.
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("brave://newtab")));
WaitForTimeout(kMaxTimeoutPerLoadedURL);

// Load a simple HTML page from the test server.
GURL simple_url(embedded_test_server()->GetURL("/simple.html"));
ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), simple_url));
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"update_patches": "node ./build/commands/scripts/commands.js update_patches",
"apply_patches": "node ./build/commands/scripts/commands.js apply_patches",
"start": "node ./build/commands/scripts/commands.js start",
"network-audit": "npm run test brave_network_audit_tests -- --ui-test-action-timeout=330000 --test-launcher-timeout=1300000",
"network-audit": "npm run test brave_network_audit_tests -- --ui-test-action-timeout=330000 --test-launcher-timeout=1600000",
"push_l10n": "node ./build/commands/scripts/commands.js push_l10n",
"pull_l10n": "node ./build/commands/scripts/commands.js pull_l10n",
"chromium_rebase_l10n": "node ./build/commands/scripts/commands.js chromium_rebase_l10n",
Expand Down

0 comments on commit 87144bb

Please sign in to comment.