| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "core/frame/FrameView.h" | 33 #include "core/frame/FrameView.h" |
| 34 #include "core/html/HTMLHeadElement.h" | 34 #include "core/html/HTMLHeadElement.h" |
| 35 #include "core/html/HTMLLinkElement.h" | 35 #include "core/html/HTMLLinkElement.h" |
| 36 #include "core/testing/DummyPageHolder.h" | 36 #include "core/testing/DummyPageHolder.h" |
| 37 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 38 #include "platform/weborigin/ReferrerPolicy.h" | 38 #include "platform/weborigin/ReferrerPolicy.h" |
| 39 #include "platform/weborigin/SchemeRegistry.h" | 39 #include "platform/weborigin/SchemeRegistry.h" |
| 40 #include "platform/weborigin/SecurityOrigin.h" | 40 #include "platform/weborigin/SecurityOrigin.h" |
| 41 #include "testing/gmock/include/gmock/gmock.h" | 41 #include "testing/gmock/include/gmock/gmock.h" |
| 42 #include "testing/gtest/include/gtest/gtest.h" | 42 #include "testing/gtest/include/gtest/gtest.h" |
| 43 #include <memory> | |
| 44 | 43 |
| 45 namespace blink { | 44 namespace blink { |
| 46 | 45 |
| 47 class DocumentTest : public ::testing::Test { | 46 class DocumentTest : public ::testing::Test { |
| 48 protected: | 47 protected: |
| 49 void SetUp() override; | 48 void SetUp() override; |
| 50 | 49 |
| 51 void TearDown() override | 50 void TearDown() override |
| 52 { | 51 { |
| 53 ThreadHeap::collectAllGarbage(); | 52 ThreadHeap::collectAllGarbage(); |
| 54 } | 53 } |
| 55 | 54 |
| 56 Document& document() const { return m_dummyPageHolder->document(); } | 55 Document& document() const { return m_dummyPageHolder->document(); } |
| 57 Page& page() const { return m_dummyPageHolder->page(); } | 56 Page& page() const { return m_dummyPageHolder->page(); } |
| 58 | 57 |
| 59 void setHtmlInnerHTML(const char*); | 58 void setHtmlInnerHTML(const char*); |
| 60 | 59 |
| 61 private: | 60 private: |
| 62 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; | 61 OwnPtr<DummyPageHolder> m_dummyPageHolder; |
| 63 }; | 62 }; |
| 64 | 63 |
| 65 void DocumentTest::SetUp() | 64 void DocumentTest::SetUp() |
| 66 { | 65 { |
| 67 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 66 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
| 68 } | 67 } |
| 69 | 68 |
| 70 void DocumentTest::setHtmlInnerHTML(const char* htmlContent) | 69 void DocumentTest::setHtmlInnerHTML(const char* htmlContent) |
| 71 { | 70 { |
| 72 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); | 71 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); | 277 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); |
| 279 | 278 |
| 280 origin = SecurityOrigin::createFromString("https://example.test"); | 279 origin = SecurityOrigin::createFromString("https://example.test"); |
| 281 document().setSecurityOrigin(origin); | 280 document().setSecurityOrigin(origin); |
| 282 document().enforceSandboxFlags(mask); | 281 document().enforceSandboxFlags(mask); |
| 283 EXPECT_TRUE(document().getSecurityOrigin()->isUnique()); | 282 EXPECT_TRUE(document().getSecurityOrigin()->isUnique()); |
| 284 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); | 283 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); |
| 285 } | 284 } |
| 286 | 285 |
| 287 } // namespace blink | 286 } // namespace blink |
| OLD | NEW |