Skip to content

Commit

Permalink
Adds a test for a wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyZhukovsky committed Oct 5, 2021
1 parent 84ba5e6 commit eb067f5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions browser/brave_wallet/brave_wallet_ethereum_chain_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,27 @@ IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, AddBrokenChain) {
ASSERT_FALSE(tab_helper->IsShowingBubble());
EXPECT_EQ(base::Value(true), result_first.value);
}

IN_PROC_BROWSER_TEST_F(BraveWalletEthereumChainTest, CheckIncognitoTab) {
GURL url =
https_server()->GetURL("a.com", "/brave_wallet_ethereum_chain.html");
Browser* private_browser = CreateIncognitoBrowser(nullptr);
ui_test_utils::NavigateToURL(private_browser, url);
content::WebContents* contents =
private_browser->tab_strip_model()->GetActiveWebContents();
WaitForLoadStop(contents);
EXPECT_EQ(url, contents->GetURL());
base::RunLoop().RunUntilIdle();
std::string title;
ASSERT_TRUE(
ExecuteScriptAndExtractString(contents,
"window.domAutomationController.send("
"document.title)",
&title));
EXPECT_EQ(title, "PAGE_SCRIPT_STARTED");
auto result_first = EvalJs(contents,
"window.domAutomationController.send("
"window.ethereum != null)",
content::EXECUTE_SCRIPT_USE_MANUAL_REPLY);
EXPECT_EQ(base::Value(false), result_first.value);
}
1 change: 1 addition & 0 deletions test/data/brave-wallet/brave_wallet_ethereum_chain.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<html>
<head><title>OK</title>
<script>
document.title = "PAGE_SCRIPT_STARTED";
var request_finished = false;
var chain_added_result = false;
const url = new URL(window.location.href)
Expand Down

0 comments on commit eb067f5

Please sign in to comment.