Skip to content

Commit

Permalink
Add test for lazy load dapp detection
Browse files Browse the repository at this point in the history
  • Loading branch information
bbondy committed May 13, 2020
1 parent e8db150 commit cfb2805
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/brave_generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ By installing this extension, you are agreeing to the Google Widevine Terms of U
SETUP
</message>
<message name="IDS_BRAVE_CRYPTO_WALLETS_START_AND_RELOAD" desc="Start Crypto Wallets and reload">
Start Crypto Wallets and relaod
Start Crypto Wallets and reload
</message>
<message name="IDS_BRAVE_CRYPTO_WALLETS_SETTINGS" desc="Open Crypto Wallets settings">
Settings
Expand Down
14 changes: 14 additions & 0 deletions browser/extensions/brave_wallet_apitest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,25 @@ IN_PROC_BROWSER_TEST_F(BraveWalletExtensionApiTest,
ResultCatcher catcher;
const Extension* extension =
LoadExtension(extension_dir_.AppendASCII("braveShieldsWithWallet"));
LoadExtension(extension_dir_.AppendASCII("braveWallet"));
ASSERT_TRUE(browsertest_util::ExecuteScriptInBackgroundPageNoWait(
browser()->profile(), brave_extension_id, "testNoDappCheck()"));
ASSERT_TRUE(extension);
ASSERT_TRUE(catcher.GetNextResult()) << message_;
}

IN_PROC_BROWSER_TEST_F(BraveWalletExtensionApiTest,
BraveShieldsDappDetectionWhenCryptoWalletsNotReady) {
GetPrefs()->SetInteger(kBraveWalletWeb3Provider,
static_cast<int>(BraveWalletWeb3ProviderTypes::CRYPTO_WALLETS));
ResultCatcher catcher;
const Extension* extension =
LoadExtension(extension_dir_.AppendASCII("braveShieldsWithWallet"));
ASSERT_TRUE(browsertest_util::ExecuteScriptInBackgroundPageNoWait(
browser()->profile(), brave_extension_id, "testDappCheck()"));
ASSERT_TRUE(extension);
ASSERT_TRUE(catcher.GetNextResult()) << message_;
}

} // namespace
} // namespace extensions
2 changes: 1 addition & 1 deletion components/brave_wallet/browser/brave_wallet_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ bool BraveWalletService::IsCryptoWalletsSetup() const {

bool BraveWalletService::IsCryptoWalletsReady() const {
auto* registry = extensions::ExtensionRegistry::Get(context_);
return registry->enabled_extensions().Contains(
return registry->ready_extensions().Contains(
ethereum_remote_client_extension_id);
}

Expand Down

0 comments on commit cfb2805

Please sign in to comment.