| 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/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
| 10 #include "chrome/test/base/test_launcher_utils.h" | 10 #include "chrome/test/base/test_launcher_utils.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 EXPECT_TRUE(content::ExecuteJavaScript( | 96 EXPECT_TRUE(content::ExecuteJavaScript( |
| 97 source2->GetWebContents()->GetRenderViewHost(), std::wstring(), | 97 source2->GetWebContents()->GetRenderViewHost(), std::wstring(), |
| 98 cookie_script2)); | 98 cookie_script2)); |
| 99 | 99 |
| 100 // Test the regular browser context to ensure we still have only one cookie. | 100 // Test the regular browser context to ensure we still have only one cookie. |
| 101 automation_util::GetCookies(GURL("http://localhost"), | 101 automation_util::GetCookies(GURL("http://localhost"), |
| 102 chrome::GetWebContentsAt(browser(), 0), | 102 chrome::GetWebContentsAt(browser(), 0), |
| 103 &cookie_size, &cookie_value); | 103 &cookie_size, &cookie_value); |
| 104 EXPECT_EQ("testCookie=1", cookie_value); | 104 EXPECT_EQ("testCookie=1", cookie_value); |
| 105 | 105 |
| 106 // Now, test the browser tags to ensure we have properly set the cookie and | 106 // The default behavior is to combine webview tags with no explicit partition |
| 107 // we have only one per browser tag and they are not the same. | 107 // declaration into the same in-memory partition. Test the webview tags to |
| 108 // ensure we have properly set the cookies and we have both cookies in both |
| 109 // tags. |
| 108 automation_util::GetCookies(GURL("http://localhost"), | 110 automation_util::GetCookies(GURL("http://localhost"), |
| 109 source1->GetWebContents(), | 111 source1->GetWebContents(), |
| 110 &cookie_size, &cookie_value); | 112 &cookie_size, &cookie_value); |
| 111 EXPECT_EQ("guest1=true", cookie_value); | 113 EXPECT_EQ("guest1=true; guest2=true", cookie_value); |
| 112 | 114 |
| 113 automation_util::GetCookies(GURL("http://localhost"), | 115 automation_util::GetCookies(GURL("http://localhost"), |
| 114 source2->GetWebContents(), | 116 source2->GetWebContents(), |
| 115 &cookie_size, &cookie_value); | 117 &cookie_size, &cookie_value); |
| 116 EXPECT_EQ("guest2=true", cookie_value); | 118 EXPECT_EQ("guest1=true; guest2=true", cookie_value); |
| 117 } | 119 } |
| OLD | NEW |