| 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 "public/web/WebDocument.h" | 5 #include "public/web/WebDocument.h" |
| 6 | 6 |
| 7 #include "core/CSSPropertyNames.h" | 7 #include "core/CSSPropertyNames.h" |
| 8 #include "core/HTMLNames.h" | 8 #include "core/HTMLNames.h" |
| 9 #include "core/dom/NodeComputedStyle.h" | 9 #include "core/dom/NodeComputedStyle.h" |
| 10 #include "core/dom/StyleEngine.h" | 10 #include "core/dom/StyleEngine.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 URLTestHelpers::registerMockedURLLoad(toKURL(std::string(kDefaultOrigin) + k
ManifestDummyFilePath), WebString::fromUTF8(kManifestDummyFilePath)); | 45 URLTestHelpers::registerMockedURLLoad(toKURL(std::string(kDefaultOrigin) + k
ManifestDummyFilePath), WebString::fromUTF8(kManifestDummyFilePath)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void WebDocumentTest::loadURL(const std::string& url) | 48 void WebDocumentTest::loadURL(const std::string& url) |
| 49 { | 49 { |
| 50 m_webViewHelper.initializeAndLoad(url); | 50 m_webViewHelper.initializeAndLoad(url); |
| 51 } | 51 } |
| 52 | 52 |
| 53 Document* WebDocumentTest::topDocument() const | 53 Document* WebDocumentTest::topDocument() const |
| 54 { | 54 { |
| 55 return toLocalFrame(m_webViewHelper.webViewImpl()->page()->mainFrame())->doc
ument(); | 55 return toLocalFrame(m_webViewHelper.webView()->page()->mainFrame())->documen
t(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebDocument WebDocumentTest::topWebDocument() const | 58 WebDocument WebDocumentTest::topWebDocument() const |
| 59 { | 59 { |
| 60 return m_webViewHelper.webView()->mainFrame()->document(); | 60 return m_webViewHelper.webView()->mainFrame()->document(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 TEST_F(WebDocumentTest, InsertStyleSheet) | 63 TEST_F(WebDocumentTest, InsertStyleSheet) |
| 64 { | 64 { |
| 65 loadURL("about:blank"); | 65 loadURL("about:blank"); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 URLTestHelpers::registerMockedURLLoad(toOriginB(nestedOriginB), WebString::f
romUTF8(nestedOriginB)); | 209 URLTestHelpers::registerMockedURLLoad(toOriginB(nestedOriginB), WebString::f
romUTF8(nestedOriginB)); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void WebDocumentFirstPartyTest::load(const char* file) | 212 void WebDocumentFirstPartyTest::load(const char* file) |
| 213 { | 213 { |
| 214 m_webViewHelper.initializeAndLoad(std::string(baseURLOriginA) + file); | 214 m_webViewHelper.initializeAndLoad(std::string(baseURLOriginA) + file); |
| 215 } | 215 } |
| 216 | 216 |
| 217 Document* WebDocumentFirstPartyTest::nestedDocument() const | 217 Document* WebDocumentFirstPartyTest::nestedDocument() const |
| 218 { | 218 { |
| 219 return toLocalFrame(m_webViewHelper.webViewImpl()->page()->mainFrame()->tree
().firstChild())->document(); | 219 return toLocalFrame(m_webViewHelper.webView()->page()->mainFrame()->tree().f
irstChild())->document(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 Document* WebDocumentFirstPartyTest::nestedNestedDocument() const | 222 Document* WebDocumentFirstPartyTest::nestedNestedDocument() const |
| 223 { | 223 { |
| 224 return toLocalFrame(m_webViewHelper.webViewImpl()->page()->mainFrame()->tree
().firstChild()->tree().firstChild())->document(); | 224 return toLocalFrame(m_webViewHelper.webView()->page()->mainFrame()->tree().f
irstChild()->tree().firstChild())->document(); |
| 225 } | 225 } |
| 226 | 226 |
| 227 TEST_F(WebDocumentFirstPartyTest, Empty) | 227 TEST_F(WebDocumentFirstPartyTest, Empty) |
| 228 { | 228 { |
| 229 load(emptyFile); | 229 load(emptyFile); |
| 230 | 230 |
| 231 ASSERT_EQ(toOriginA(emptyFile), topDocument()->firstPartyForCookies()); | 231 ASSERT_EQ(toOriginA(emptyFile), topDocument()->firstPartyForCookies()); |
| 232 } | 232 } |
| 233 | 233 |
| 234 TEST_F(WebDocumentFirstPartyTest, NestedOriginA) | 234 TEST_F(WebDocumentFirstPartyTest, NestedOriginA) |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 load(nestedOriginAInOriginB); | 320 load(nestedOriginAInOriginB); |
| 321 | 321 |
| 322 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); | 322 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http"); |
| 323 | 323 |
| 324 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), topDocument()->firstPartyForCoo
kies()); | 324 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), topDocument()->firstPartyForCoo
kies()); |
| 325 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedDocument()->firstPartyFor
Cookies()); | 325 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedDocument()->firstPartyFor
Cookies()); |
| 326 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedNestedDocument()->firstPa
rtyForCookies()); | 326 ASSERT_EQ(toOriginA(nestedOriginAInOriginB), nestedNestedDocument()->firstPa
rtyForCookies()); |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace blink | 329 } // namespace blink |
| OLD | NEW |