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

Unified Diff: chrome/browser/extensions/app_process_apitest.cc

Issue 10990038: Grant popup blocker bypass based upon extension context type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | « no previous file | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/app_process_apitest.cc
===================================================================
--- chrome/browser/extensions/app_process_apitest.cc (revision 158606)
+++ chrome/browser/extensions/app_process_apitest.cc (working copy)
@@ -7,6 +7,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/process_map.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -118,6 +119,16 @@
}
};
+// Omits the disable-popup-blocking flag so we can cover that case.
+class BlockedAppApiTest : public AppApiTest {
+ protected:
+ void SetUpCommandLine(CommandLine* command_line) {
+ ExtensionApiTest::SetUpCommandLine(command_line);
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kAllowHTTPBackgroundPage);
+ }
+};
+
// Tests that hosted apps with the background permission get a process-per-app
// model, since all pages need to be able to script the background page.
IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) {
@@ -453,8 +464,8 @@
ASSERT_TRUE(app);
content::WindowedNotificationObserver popup_observer(
- content::NOTIFICATION_RENDER_VIEW_HOST_CREATED,
- content::NotificationService::AllSources());
+ content::NOTIFICATION_RENDER_VIEW_HOST_CREATED,
+ content::NotificationService::AllSources());
ui_test_utils::NavigateToURL(browser(),
base_url.Resolve("path3/container.html"));
EXPECT_FALSE(process_map->Contains(
@@ -467,6 +478,33 @@
EXPECT_TRUE(process_map->Contains(popup_host->GetProcess()->GetID()));
}
+// Similar to the previous test, but ensure that popup blocking bypass
+// isn't granted to the iframe. See crbug.com/117446.
+IN_PROC_BROWSER_TEST_F(BlockedAppApiTest, OpenAppFromIframe) {
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+
+ // Load app and start URL (not in the app).
+ const Extension* app =
+ LoadExtension(test_data_dir_.AppendASCII("app_process"));
+ ASSERT_TRUE(app);
+
+ content::WindowedNotificationObserver blocker_observer(
+ chrome::NOTIFICATION_CONTENT_BLOCKED_STATE_CHANGED,
+ content::NotificationService::AllSources());
+ ui_test_utils::NavigateToURL(
+ browser(), GetTestBaseURL("app_process").Resolve("path3/container.html"));
+
+ blocker_observer.Wait();
+
+ WebContents* tab = chrome::GetActiveWebContents(browser());
+ BlockedContentTabHelper* blocked_content_tab_helper =
+ BlockedContentTabHelper::FromWebContents(tab);
+ std::vector<WebContents*> blocked_contents;
+ blocked_content_tab_helper->GetBlockedContents(&blocked_contents);
+ EXPECT_EQ(blocked_contents.size(), 1u);
+}
+
// Tests that if an extension launches an app via chrome.tabs.create with an URL
// that's not in the app's extent but that redirects to it, we still end up with
// an app process. See http://crbug.com/99349 for more details.
« no previous file with comments | « no previous file | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698