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 <string> |
| 8 |
7 #include "core/CSSPropertyNames.h" | 9 #include "core/CSSPropertyNames.h" |
8 #include "core/HTMLNames.h" | 10 #include "core/HTMLNames.h" |
9 #include "core/dom/NodeComputedStyle.h" | 11 #include "core/dom/NodeComputedStyle.h" |
10 #include "core/dom/StyleEngine.h" | 12 #include "core/dom/StyleEngine.h" |
11 #include "core/frame/FrameTestHelpers.h" | 13 #include "core/frame/FrameTestHelpers.h" |
12 #include "core/frame/LocalFrame.h" | 14 #include "core/frame/LocalFrame.h" |
| 15 #include "core/frame/WebLocalFrameBase.h" |
13 #include "core/html/HTMLElement.h" | 16 #include "core/html/HTMLElement.h" |
14 #include "core/html/HTMLLinkElement.h" | 17 #include "core/html/HTMLLinkElement.h" |
15 #include "core/page/Page.h" | 18 #include "core/page/Page.h" |
16 #include "core/style/ComputedStyle.h" | 19 #include "core/style/ComputedStyle.h" |
17 #include "platform/RuntimeEnabledFeatures.h" | 20 #include "platform/RuntimeEnabledFeatures.h" |
18 #include "platform/graphics/Color.h" | 21 #include "platform/graphics/Color.h" |
19 #include "platform/testing/URLTestHelpers.h" | 22 #include "platform/testing/URLTestHelpers.h" |
20 #include "platform/testing/UnitTestHelpers.h" | 23 #include "platform/testing/UnitTestHelpers.h" |
21 #include "platform/weborigin/SchemeRegistry.h" | 24 #include "platform/weborigin/SchemeRegistry.h" |
22 #include "platform/weborigin/SecurityOrigin.h" | 25 #include "platform/weborigin/SecurityOrigin.h" |
(...skipping 27 matching lines...) Expand all Loading... |
50 void WebDocumentTest::LoadURL(const std::string& url) { | 53 void WebDocumentTest::LoadURL(const std::string& url) { |
51 web_view_helper_.InitializeAndLoad(url); | 54 web_view_helper_.InitializeAndLoad(url); |
52 } | 55 } |
53 | 56 |
54 Document* WebDocumentTest::TopDocument() const { | 57 Document* WebDocumentTest::TopDocument() const { |
55 return ToLocalFrame(web_view_helper_.WebView()->GetPage()->MainFrame()) | 58 return ToLocalFrame(web_view_helper_.WebView()->GetPage()->MainFrame()) |
56 ->GetDocument(); | 59 ->GetDocument(); |
57 } | 60 } |
58 | 61 |
59 WebDocument WebDocumentTest::TopWebDocument() const { | 62 WebDocument WebDocumentTest::TopWebDocument() const { |
60 return web_view_helper_.WebView()->MainFrame()->GetDocument(); | 63 return web_view_helper_.WebView()->MainFrameImpl()->GetDocument(); |
61 } | 64 } |
62 | 65 |
63 TEST_F(WebDocumentTest, InsertAndRemoveStyleSheet) { | 66 TEST_F(WebDocumentTest, InsertAndRemoveStyleSheet) { |
64 LoadURL("about:blank"); | 67 LoadURL("about:blank"); |
65 | 68 |
66 WebDocument web_doc = TopWebDocument(); | 69 WebDocument web_doc = TopWebDocument(); |
67 Document* core_doc = TopDocument(); | 70 Document* core_doc = TopDocument(); |
68 | 71 |
69 unsigned start_count = core_doc->GetStyleEngine().StyleForElementCount(); | 72 unsigned start_count = core_doc->GetStyleEngine().StyleForElementCount(); |
70 | 73 |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 379 |
377 ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), | 380 ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), |
378 TopDocument()->FirstPartyForCookies()); | 381 TopDocument()->FirstPartyForCookies()); |
379 ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), | 382 ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), |
380 NestedDocument()->FirstPartyForCookies()); | 383 NestedDocument()->FirstPartyForCookies()); |
381 ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), | 384 ASSERT_EQ(ToOriginA(g_nested_origin_a_in_origin_b), |
382 NestedNestedDocument()->FirstPartyForCookies()); | 385 NestedNestedDocument()->FirstPartyForCookies()); |
383 } | 386 } |
384 | 387 |
385 } // namespace blink | 388 } // namespace blink |
OLD | NEW |