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

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

Issue 10349015: Make platform apps get isolated storage by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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
Index: chrome/browser/extensions/platform_app_browsertest.cc
diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc
index d2929906503c170b1717151003b3adbe494d01bf..ee6009b2463acdc7acdad6b84cfae0f24e4ae725 100644
--- a/chrome/browser/extensions/platform_app_browsertest.cc
+++ b/chrome/browser/extensions/platform_app_browsertest.cc
@@ -5,6 +5,7 @@
#include "base/command_line.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/automation/automation_util.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_host.h"
@@ -179,3 +180,34 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Restrictions) {
IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApi) {
ASSERT_TRUE(RunPlatformAppTest("platform_apps/windows_api")) << message_;
}
+
+// Tests that platform apps have isolated storage by default.
+IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Isolation) {
+ ASSERT_TRUE(StartTestServer());
+
+ // Load a (non-app) page under the "localhost" origin that sets a cookie.
+ GURL set_cookie_url = test_server()->GetURL(
+ "files/extensions/platform_apps/isolation/set_cookie.html");
+ GURL::Replacements replace_host;
+ std::string host_str("localhost"); // Must stay in scope with replace_host.
+ replace_host.SetHostStr(host_str);
+ set_cookie_url = set_cookie_url.ReplaceComponents(replace_host);
+
+ ui_test_utils::NavigateToURLWithDisposition(
+ browser(), set_cookie_url,
+ CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+
+ // Make sure the cookie is set.
+ int cookie_size;
+ std::string cookie_value;
+ automation_util::GetCookies(
+ set_cookie_url,
+ browser()->GetWebContentsAt(0),
+ &cookie_size,
+ &cookie_value);
+ ASSERT_EQ("testCookie=1", cookie_value);
+
+ // Let the platform app request the same URL, and make sure that it doesn't
+ // see the cookie.
+ ASSERT_TRUE(RunPlatformAppTest("platform_apps/isolation")) << message_;
+}
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/profiles/off_the_record_profile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698