Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Unified Diff: chrome/browser/extensions/api/web_request/web_request_apitest.cc

Issue 1809813002: [Extensions] Show a "refresh" bubble when needed with click-to-script (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/extension_action_runner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/web_request/web_request_apitest.cc
diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
index 15458a5c2396fa6c919c4b05682295a55c37165c..8522337646ca271d860de635a6d6ba36ae4d0f9c 100644
--- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -527,10 +527,22 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
// Grant activeTab permission, and perform another XHR. The extension should
// receive the event.
EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension));
+ runner->set_default_bubble_close_action_for_testing(
+ make_scoped_ptr(new ToolbarActionsBarBubbleDelegate::CloseAction(
+ ToolbarActionsBarBubbleDelegate::CLOSE_EXECUTE)));
runner->RunAction(extension, true);
+ base::RunLoop().RunUntilIdle();
+ EXPECT_TRUE(content::WaitForLoadStop(web_contents));
+ // The runner will have refreshed the page...
EXPECT_EQ(BLOCKED_ACTION_NONE, runner->GetBlockedActions(extension));
+ int xhr_count = GetWebRequestCountFromBackgroundPage(extension, profile());
+ // ... which means that we should have a non-zero xhr count.
+ EXPECT_GT(xhr_count, 0);
+ // And the extension should receive future events.
PerformXhrInPage(web_contents, kHost, port, kXhrPath);
- EXPECT_EQ(1, GetWebRequestCountFromBackgroundPage(extension, profile()));
+ ++xhr_count;
+ EXPECT_EQ(xhr_count,
+ GetWebRequestCountFromBackgroundPage(extension, profile()));
// If we revoke the extension's tab permissions, it should no longer receive
// webRequest events.
@@ -540,7 +552,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
granter->RevokeForTesting();
base::RunLoop().RunUntilIdle();
PerformXhrInPage(web_contents, kHost, port, kXhrPath);
- EXPECT_EQ(1, GetWebRequestCountFromBackgroundPage(extension, profile()));
+ EXPECT_EQ(xhr_count,
+ GetWebRequestCountFromBackgroundPage(extension, profile()));
EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension));
}
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/extensions/extension_action_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698