| 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> |
| 43 | 44 |
| 44 namespace blink { | 45 namespace blink { |
| 45 | 46 |
| 46 class DocumentTest : public ::testing::Test { | 47 class DocumentTest : public ::testing::Test { |
| 47 protected: | 48 protected: |
| 48 void SetUp() override; | 49 void SetUp() override; |
| 49 | 50 |
| 50 void TearDown() override | 51 void TearDown() override |
| 51 { | 52 { |
| 52 ThreadHeap::collectAllGarbage(); | 53 ThreadHeap::collectAllGarbage(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 Document& document() const { return m_dummyPageHolder->document(); } | 56 Document& document() const { return m_dummyPageHolder->document(); } |
| 56 Page& page() const { return m_dummyPageHolder->page(); } | 57 Page& page() const { return m_dummyPageHolder->page(); } |
| 57 | 58 |
| 58 void setHtmlInnerHTML(const char*); | 59 void setHtmlInnerHTML(const char*); |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 OwnPtr<DummyPageHolder> m_dummyPageHolder; | 62 std::unique_ptr<DummyPageHolder> m_dummyPageHolder; |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 void DocumentTest::SetUp() | 65 void DocumentTest::SetUp() |
| 65 { | 66 { |
| 66 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); | 67 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void DocumentTest::setHtmlInnerHTML(const char* htmlContent) | 70 void DocumentTest::setHtmlInnerHTML(const char* htmlContent) |
| 70 { | 71 { |
| 71 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); | 72 document().documentElement()->setInnerHTML(String::fromUTF8(htmlContent), AS
SERT_NO_EXCEPTION); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); | 278 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); |
| 278 | 279 |
| 279 origin = SecurityOrigin::createFromString("https://example.test"); | 280 origin = SecurityOrigin::createFromString("https://example.test"); |
| 280 document().setSecurityOrigin(origin); | 281 document().setSecurityOrigin(origin); |
| 281 document().enforceSandboxFlags(mask); | 282 document().enforceSandboxFlags(mask); |
| 282 EXPECT_TRUE(document().getSecurityOrigin()->isUnique()); | 283 EXPECT_TRUE(document().getSecurityOrigin()->isUnique()); |
| 283 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); | 284 EXPECT_TRUE(document().getSecurityOrigin()->isPotentiallyTrustworthy()); |
| 284 } | 285 } |
| 285 | 286 |
| 286 } // namespace blink | 287 } // namespace blink |
| OLD | NEW |