OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "public/web/WebDocument.h" | 6 #include "public/web/WebDocument.h" |
7 | 7 |
8 #include "core/CSSPropertyNames.h" | 8 #include "core/CSSPropertyNames.h" |
9 #include "core/HTMLNames.h" | 9 #include "core/HTMLNames.h" |
10 #include "core/dom/NodeComputedStyle.h" | 10 #include "core/dom/NodeComputedStyle.h" |
11 #include "core/dom/StyleEngine.h" | 11 #include "core/dom/StyleEngine.h" |
12 #include "core/frame/LocalFrame.h" | 12 #include "core/frame/LocalFrame.h" |
13 #include "core/html/HTMLElement.h" | 13 #include "core/html/HTMLElement.h" |
14 #include "core/html/HTMLLinkElement.h" | 14 #include "core/html/HTMLLinkElement.h" |
| 15 #include "core/page/Page.h" |
15 #include "core/style/ComputedStyle.h" | 16 #include "core/style/ComputedStyle.h" |
16 #include "core/page/Page.h" | |
17 #include "platform/RuntimeEnabledFeatures.h" | 17 #include "platform/RuntimeEnabledFeatures.h" |
18 #include "platform/graphics/Color.h" | 18 #include "platform/graphics/Color.h" |
19 #include "platform/testing/URLTestHelpers.h" | 19 #include "platform/testing/URLTestHelpers.h" |
| 20 #include "platform/weborigin/SchemeRegistry.h" |
20 #include "platform/weborigin/SecurityOrigin.h" | 21 #include "platform/weborigin/SecurityOrigin.h" |
21 #include "web/tests/FrameTestHelpers.h" | 22 #include "web/tests/FrameTestHelpers.h" |
22 #include <gtest/gtest.h> | 23 #include <gtest/gtest.h> |
23 | 24 |
24 namespace blink { | 25 namespace blink { |
25 | 26 |
26 using blink::FrameTestHelpers::WebViewHelper; | 27 using blink::FrameTestHelpers::WebViewHelper; |
27 using blink::URLTestHelpers::toKURL; | 28 using blink::URLTestHelpers::toKURL; |
28 | 29 |
29 const char* kDefaultOrigin = "https://example.test/"; | 30 const char* kDefaultOrigin = "https://example.test/"; |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 290 } |
290 | 291 |
291 TEST_F(WebDocumentFirstPartyTest, NestedData) | 292 TEST_F(WebDocumentFirstPartyTest, NestedData) |
292 { | 293 { |
293 load(nestedData); | 294 load(nestedData); |
294 | 295 |
295 ASSERT_EQ(toOriginA(nestedData), topDocument()->firstPartyForCookies()); | 296 ASSERT_EQ(toOriginA(nestedData), topDocument()->firstPartyForCookies()); |
296 ASSERT_EQ(SecurityOrigin::urlWithUniqueSecurityOrigin(), nestedDocument()->f
irstPartyForCookies()); | 297 ASSERT_EQ(SecurityOrigin::urlWithUniqueSecurityOrigin(), nestedDocument()->f
irstPartyForCookies()); |
297 } | 298 } |
298 | 299 |
| 300 TEST_F(WebDocumentFirstPartyTest, NestedOriginAInOriginBWithFirstPartyOverride) |
| 301 { |
| 302 load(nestedOriginAInOriginB); |
| 303 |
| 304 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); |
| 305 |
| 306 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), topDocument()->firstPartyForCoo
kies()); |
| 307 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedDocument()->firstPartyFor
Cookies()); |
| 308 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedNestedDocument()->firstPa
rtyForCookies()); |
| 309 } |
| 310 |
299 } // namespace blink | 311 } // namespace blink |
OLD | NEW |