Chromium Code Reviews| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 LoadAndLaunchPlatformApp("web_view_isolation"); | 79 LoadAndLaunchPlatformApp("web_view_isolation"); |
| 80 observer1.Wait(); | 80 observer1.Wait(); |
| 81 observer2.Wait(); | 81 observer2.Wait(); |
| 82 | 82 |
| 83 content::Source<content::NavigationController> source1 = observer1.source(); | 83 content::Source<content::NavigationController> source1 = observer1.source(); |
| 84 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 84 EXPECT_TRUE(source1->GetWebContents()->GetRenderProcessHost()->IsGuest()); |
| 85 content::Source<content::NavigationController> source2 = observer2.source(); | 85 content::Source<content::NavigationController> source2 = observer2.source(); |
| 86 EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()->IsGuest()); | 86 EXPECT_TRUE(source2->GetWebContents()->GetRenderProcessHost()->IsGuest()); |
| 87 EXPECT_NE(source1->GetWebContents()->GetRenderProcessHost()->GetID(), | 87 EXPECT_NE(source1->GetWebContents()->GetRenderProcessHost()->GetID(), |
| 88 source2->GetWebContents()->GetRenderProcessHost()->GetID()); | 88 source2->GetWebContents()->GetRenderProcessHost()->GetID()); |
| 89 EXPECT_EQ( | |
| 90 source1->GetWebContents()->GetRenderProcessHost()->GetStoragePartition(), | |
| 91 source2->GetWebContents()->GetRenderProcessHost()->GetStoragePartition()); | |
|
Charlie Reis
2012/10/27 01:11:43
Either we should get rid of this (to make it easie
awong
2012/10/27 01:23:54
I TODOed it.
| |
| 89 | 92 |
| 90 EXPECT_TRUE(content::ExecuteJavaScript( | 93 EXPECT_TRUE(content::ExecuteJavaScript( |
| 91 source1->GetWebContents()->GetRenderViewHost(), std::wstring(), | 94 source1->GetWebContents()->GetRenderViewHost(), std::wstring(), |
| 92 cookie_script1)); | 95 cookie_script1)); |
| 93 EXPECT_TRUE(content::ExecuteJavaScript( | 96 EXPECT_TRUE(content::ExecuteJavaScript( |
| 94 source2->GetWebContents()->GetRenderViewHost(), std::wstring(), | 97 source2->GetWebContents()->GetRenderViewHost(), std::wstring(), |
| 95 cookie_script2)); | 98 cookie_script2)); |
| 96 | 99 |
| 97 // 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. |
| 98 automation_util::GetCookies(GURL("http://localhost"), | 101 automation_util::GetCookies(GURL("http://localhost"), |
| 99 chrome::GetWebContentsAt(browser(), 0), | 102 chrome::GetWebContentsAt(browser(), 0), |
| 100 &cookie_size, &cookie_value); | 103 &cookie_size, &cookie_value); |
| 101 EXPECT_EQ("testCookie=1", cookie_value); | 104 EXPECT_EQ("testCookie=1", cookie_value); |
| 102 | 105 |
| 103 // Now, test the browser tags to ensure we have properly set the cookie and | 106 // 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. | 107 // declaration into the same in-memory partition. Test the browser tags to |
| 108 // ensure we have properly set the cookies and we have both cookies in both | |
| 109 // browser tags. | |
| 105 automation_util::GetCookies(GURL("http://localhost"), | 110 automation_util::GetCookies(GURL("http://localhost"), |
| 106 source1->GetWebContents(), | 111 source1->GetWebContents(), |
| 107 &cookie_size, &cookie_value); | 112 &cookie_size, &cookie_value); |
| 108 EXPECT_EQ("guest1=true", cookie_value); | 113 EXPECT_EQ("guest1=true; guest2=true", cookie_value); |
| 109 | 114 |
| 110 automation_util::GetCookies(GURL("http://localhost"), | 115 automation_util::GetCookies(GURL("http://localhost"), |
| 111 source2->GetWebContents(), | 116 source2->GetWebContents(), |
| 112 &cookie_size, &cookie_value); | 117 &cookie_size, &cookie_value); |
| 113 EXPECT_EQ("guest2=true", cookie_value); | 118 EXPECT_EQ("guest1=true; guest2=true", cookie_value); |
| 114 } | 119 } |
| OLD | NEW |