| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/automation/automation_util.h" | 5 #include "chrome/browser/automation/automation_util.h" |
| 6 #include "chrome/browser/extensions/platform_app_browsertest_util.h" | 6 #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| 7 #include "chrome/browser/ui/browser_tabstrip.h" | 7 #include "chrome/browser/ui/browser_tabstrip.h" |
| 8 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
| 9 #include "chrome/test/base/test_launcher_utils.h" | 9 #include "chrome/test/base/test_launcher_utils.h" |
| 10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 EXPECT_TRUE(content::ExecuteJavaScript( | 93 EXPECT_TRUE(content::ExecuteJavaScript( |
| 94 source2->GetWebContents()->GetRenderViewHost(), std::wstring(), | 94 source2->GetWebContents()->GetRenderViewHost(), std::wstring(), |
| 95 cookie_script2)); | 95 cookie_script2)); |
| 96 | 96 |
| 97 // Test the regular browser context to ensure we still have only one cookie. | 97 // Test the regular browser context to ensure we still have only one cookie. |
| 98 automation_util::GetCookies(GURL("http://localhost"), | 98 automation_util::GetCookies(GURL("http://localhost"), |
| 99 chrome::GetWebContentsAt(browser(), 0), | 99 chrome::GetWebContentsAt(browser(), 0), |
| 100 &cookie_size, &cookie_value); | 100 &cookie_size, &cookie_value); |
| 101 EXPECT_EQ("testCookie=1", cookie_value); | 101 EXPECT_EQ("testCookie=1", cookie_value); |
| 102 | 102 |
| 103 // Now, test the browser tags to ensure we have properly set the cookie and | 103 // The default behavior is to combine browser tags with no explicit partition |
| 104 // we have only one per browser tag and they are not the same. | 104 // declaration into the same in-memory partition. Test the browser tags to |
| 105 // ensure we have properly set the cookies and we have both cookies in both |
| 106 // browser tags. See code the cookie_scripts earlier in this test to find |
| 107 // where we set the guestX= values. |
| 108 // |
| 109 // TODO(ajwong): We should add a test in the javascript level that asserts the |
| 110 // various storage types are isolated. |
| 105 automation_util::GetCookies(GURL("http://localhost"), | 111 automation_util::GetCookies(GURL("http://localhost"), |
| 106 source1->GetWebContents(), | 112 source1->GetWebContents(), |
| 107 &cookie_size, &cookie_value); | 113 &cookie_size, &cookie_value); |
| 108 EXPECT_EQ("guest1=true", cookie_value); | 114 EXPECT_EQ("guest1=true; guest2=true", cookie_value); |
| 109 | 115 |
| 110 automation_util::GetCookies(GURL("http://localhost"), | 116 automation_util::GetCookies(GURL("http://localhost"), |
| 111 source2->GetWebContents(), | 117 source2->GetWebContents(), |
| 112 &cookie_size, &cookie_value); | 118 &cookie_size, &cookie_value); |
| 113 EXPECT_EQ("guest2=true", cookie_value); | 119 EXPECT_EQ("guest1=true; guest2=true", cookie_value); |
| 114 } | 120 } |
| OLD | NEW |