Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: third_party/WebKit/Source/web/tests/LinkElementLoadingTest.cpp

Issue 2173413002: Add a test for canceling a pending stylesheet loading of a link element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/web.gypi » ('j') | third_party/WebKit/Source/web/web.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698