| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/dom/Document.h" |
| 6 #include "core/html/HTMLLinkElement.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "web/tests/sim/SimRequest.h" |
| 9 #include "web/tests/sim/SimTest.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class LinkElementLoadingTest : public SimTest { |
| 14 }; |
| 15 |
| 16 TEST_F(LinkElementLoadingTest, ShouldCancelLoadingStyleSheetIfLinkElementIsDisco
nnected) |
| 17 { |
| 18 SimRequest mainResource("https://example.com/test.html", "text/html"); |
| 19 SimRequest cssResource("https://example.com/test.css", "text/css"); |
| 20 |
| 21 loadURL("https://example.com/test.html"); |
| 22 |
| 23 mainResource.start(); |
| 24 mainResource.write("<!DOCTYPE html><link id=link rel=stylesheet href=test.cs
s>"); |
| 25 |
| 26 // Sheet is streaming in, but not ready yet. |
| 27 cssResource.start(); |
| 28 |
| 29 // Remove a link element from a document |
| 30 HTMLLinkElement* link = toHTMLLinkElement(document().getElementById("link"))
; |
| 31 EXPECT_NE(nullptr, link); |
| 32 link->remove(); |
| 33 |
| 34 // Finish the load. |
| 35 cssResource.complete(); |
| 36 mainResource.finish(); |
| 37 |
| 38 // Link element's sheet loading should be canceled. |
| 39 EXPECT_EQ(nullptr, link->sheet()); |
| 40 } |
| 41 |
| 42 } // namespace blink |
| OLD | NEW |