| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "core/dom/Document.h" | 5 #include "core/dom/Document.h" |
| 6 #include "core/html/HTMLLinkElement.h" | 6 #include "core/html/HTMLLinkElement.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "web/tests/sim/SimRequest.h" | 8 #include "web/tests/sim/SimRequest.h" |
| 9 #include "web/tests/sim/SimTest.h" | 9 #include "web/tests/sim/SimTest.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 class HTMLImportSheetsTest : public SimTest { | 13 class HTMLImportSheetsTest : public SimTest { |
| 14 protected: | 14 protected: |
| 15 HTMLImportSheetsTest() { WebView().Resize(WebSize(640, 480)); } | 15 HTMLImportSheetsTest() {} |
| 16 |
| 17 void SetUp() override { |
| 18 SimTest::SetUp(); |
| 19 WebView().Resize(WebSize(640, 480)); |
| 20 } |
| 16 }; | 21 }; |
| 17 | 22 |
| 18 TEST_F(HTMLImportSheetsTest, NeedsActiveStyleUpdate) { | 23 TEST_F(HTMLImportSheetsTest, NeedsActiveStyleUpdate) { |
| 19 SimRequest main_resource("https://example.com/", "text/html"); | 24 SimRequest main_resource("https://example.com/", "text/html"); |
| 20 SimRequest import_resource("https://example.com/import.html", "text/html"); | 25 SimRequest import_resource("https://example.com/import.html", "text/html"); |
| 21 | 26 |
| 22 LoadURL("https://example.com/"); | 27 LoadURL("https://example.com/"); |
| 23 main_resource.Complete("<link id=link rel=import href=import.html>"); | 28 main_resource.Complete("<link id=link rel=import href=import.html>"); |
| 24 import_resource.Complete("<style>div{}</style>"); | 29 import_resource.Complete("<style>div{}</style>"); |
| 25 | 30 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 49 ASSERT_TRUE(import_doc); | 54 ASSERT_TRUE(import_doc); |
| 50 EXPECT_TRUE(import_doc->GetStyleEngine().NeedsActiveStyleUpdate()); | 55 EXPECT_TRUE(import_doc->GetStyleEngine().NeedsActiveStyleUpdate()); |
| 51 | 56 |
| 52 import_doc->GetStyleEngine().StyleSheetsForStyleSheetList(*import_doc); | 57 import_doc->GetStyleEngine().StyleSheetsForStyleSheetList(*import_doc); |
| 53 | 58 |
| 54 EXPECT_TRUE(GetDocument().GetStyleEngine().NeedsActiveStyleUpdate()); | 59 EXPECT_TRUE(GetDocument().GetStyleEngine().NeedsActiveStyleUpdate()); |
| 55 EXPECT_FALSE(import_doc->GetStyleEngine().NeedsActiveStyleUpdate()); | 60 EXPECT_FALSE(import_doc->GetStyleEngine().NeedsActiveStyleUpdate()); |
| 56 } | 61 } |
| 57 | 62 |
| 58 } // namespace blink | 63 } // namespace blink |
| OLD | NEW |