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

Side by Side Diff: third_party/WebKit/Source/core/html/LinkRelAttributeTest.cpp

Issue 1647813003: Remove support for <link rel=subresource> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed and deleted tests Created 4 years, 10 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
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, 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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "core/html/LinkRelAttribute.h" 31 #include "core/html/LinkRelAttribute.h"
32 32
33 #include "platform/RuntimeEnabledFeatures.h" 33 #include "platform/RuntimeEnabledFeatures.h"
34 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
35 #include "wtf/text/CString.h" 35 #include "wtf/text/CString.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 static inline void testLinkRelAttribute(String value, bool isStyleSheet, IconTyp e iconType, bool isAlternate, bool isDNSPrefetch, bool isLinkSubresource, bool i sLinkPrerender, bool isImport = false, bool isPreconnect = false) 39 static inline void testLinkRelAttribute(String value, bool isStyleSheet, IconTyp e iconType, bool isAlternate, bool isDNSPrefetch, bool isLinkPrerender, bool isI mport = false, bool isPreconnect = false)
40 { 40 {
41 LinkRelAttribute linkRelAttribute(value); 41 LinkRelAttribute linkRelAttribute(value);
42 ASSERT_EQ(isStyleSheet, linkRelAttribute.isStyleSheet()) << value.utf8().dat a(); 42 ASSERT_EQ(isStyleSheet, linkRelAttribute.isStyleSheet()) << value.utf8().dat a();
43 ASSERT_EQ(iconType, linkRelAttribute.iconType()) << value.utf8().data(); 43 ASSERT_EQ(iconType, linkRelAttribute.iconType()) << value.utf8().data();
44 ASSERT_EQ(isAlternate, linkRelAttribute.isAlternate()) << value.utf8().data( ); 44 ASSERT_EQ(isAlternate, linkRelAttribute.isAlternate()) << value.utf8().data( );
45 ASSERT_EQ(isDNSPrefetch, linkRelAttribute.isDNSPrefetch()) << value.utf8().d ata(); 45 ASSERT_EQ(isDNSPrefetch, linkRelAttribute.isDNSPrefetch()) << value.utf8().d ata();
46 ASSERT_EQ(isLinkSubresource, linkRelAttribute.isLinkSubresource()) << value. utf8().data();
47 ASSERT_EQ(isLinkPrerender, linkRelAttribute.isLinkPrerender()) << value.utf8 ().data(); 46 ASSERT_EQ(isLinkPrerender, linkRelAttribute.isLinkPrerender()) << value.utf8 ().data();
48 ASSERT_EQ(isImport, linkRelAttribute.isImport()) << value.utf8().data(); 47 ASSERT_EQ(isImport, linkRelAttribute.isImport()) << value.utf8().data();
49 ASSERT_EQ(isPreconnect, linkRelAttribute.isPreconnect()) << value.utf8().dat a(); 48 ASSERT_EQ(isPreconnect, linkRelAttribute.isPreconnect()) << value.utf8().dat a();
50 } 49 }
51 50
52 TEST(LinkRelAttributeTest, Constructor) 51 TEST(LinkRelAttributeTest, Constructor)
53 { 52 {
54 testLinkRelAttribute("stylesheet", true, InvalidIcon, false, false, false, f alse); 53 testLinkRelAttribute("stylesheet", true, InvalidIcon, false, false, false);
55 testLinkRelAttribute("sTyLeShEeT", true, InvalidIcon, false, false, false, f alse); 54 testLinkRelAttribute("sTyLeShEeT", true, InvalidIcon, false, false, false);
56 55
57 testLinkRelAttribute("icon", false, Favicon, false, false, false, false); 56 testLinkRelAttribute("icon", false, Favicon, false, false, false);
58 testLinkRelAttribute("iCoN", false, Favicon, false, false, false, false); 57 testLinkRelAttribute("iCoN", false, Favicon, false, false, false);
59 testLinkRelAttribute("shortcut icon", false, Favicon, false, false, false, f alse); 58 testLinkRelAttribute("shortcut icon", false, Favicon, false, false, false);
60 testLinkRelAttribute("sHoRtCuT iCoN", false, Favicon, false, false, false, f alse); 59 testLinkRelAttribute("sHoRtCuT iCoN", false, Favicon, false, false, false);
61 60
62 testLinkRelAttribute("dns-prefetch", false, InvalidIcon, false, true, false, false); 61 testLinkRelAttribute("dns-prefetch", false, InvalidIcon, false, true, false) ;
63 testLinkRelAttribute("dNs-pReFeTcH", false, InvalidIcon, false, true, false, false); 62 testLinkRelAttribute("dNs-pReFeTcH", false, InvalidIcon, false, true, false) ;
64 testLinkRelAttribute("alternate dNs-pReFeTcH", false, InvalidIcon, true, tru e, false, false); 63 testLinkRelAttribute("alternate dNs-pReFeTcH", false, InvalidIcon, true, tru e, false);
65 64
66 testLinkRelAttribute("apple-touch-icon", false, TouchIcon, false, false, fal se, false); 65 testLinkRelAttribute("apple-touch-icon", false, TouchIcon, false, false, fal se);
67 testLinkRelAttribute("aPpLe-tOuCh-IcOn", false, TouchIcon, false, false, fal se, false); 66 testLinkRelAttribute("aPpLe-tOuCh-IcOn", false, TouchIcon, false, false, fal se);
68 testLinkRelAttribute("apple-touch-icon-precomposed", false, TouchPrecomposed Icon, false, false, false, false); 67 testLinkRelAttribute("apple-touch-icon-precomposed", false, TouchPrecomposed Icon, false, false, false);
69 testLinkRelAttribute("aPpLe-tOuCh-IcOn-pReCoMpOsEd", false, TouchPrecomposed Icon, false, false, false, false); 68 testLinkRelAttribute("aPpLe-tOuCh-IcOn-pReCoMpOsEd", false, TouchPrecomposed Icon, false, false, false);
70 69
71 testLinkRelAttribute("alternate stylesheet", true, InvalidIcon, true, false, false, false); 70 testLinkRelAttribute("alternate stylesheet", true, InvalidIcon, true, false, false);
72 testLinkRelAttribute("stylesheet alternate", true, InvalidIcon, true, false, false, false); 71 testLinkRelAttribute("stylesheet alternate", true, InvalidIcon, true, false, false);
73 testLinkRelAttribute("aLtErNaTe sTyLeShEeT", true, InvalidIcon, true, false, false, false); 72 testLinkRelAttribute("aLtErNaTe sTyLeShEeT", true, InvalidIcon, true, false, false);
74 testLinkRelAttribute("sTyLeShEeT aLtErNaTe", true, InvalidIcon, true, false, false, false); 73 testLinkRelAttribute("sTyLeShEeT aLtErNaTe", true, InvalidIcon, true, false, false);
75 74
76 testLinkRelAttribute("stylesheet icon prerender aLtErNaTe", true, Favicon, t rue, false, false, true); 75 testLinkRelAttribute("stylesheet icon prerender aLtErNaTe", true, Favicon, t rue, false, true);
77 testLinkRelAttribute("alternate subresource", false, InvalidIcon, true, fals e, true, false); 76 testLinkRelAttribute("alternate icon stylesheet", true, Favicon, true, false , false);
78 testLinkRelAttribute("alternate icon stylesheet", true, Favicon, true, false , false, false);
79 77
80 testLinkRelAttribute("import", false, InvalidIcon, false, false, false, fals e, true); 78 testLinkRelAttribute("import", false, InvalidIcon, false, false, false, true );
81 testLinkRelAttribute("alternate import", false, InvalidIcon, true, false, fa lse, false, true); 79 testLinkRelAttribute("alternate import", false, InvalidIcon, true, false, fa lse, true);
82 testLinkRelAttribute("stylesheet import", true, InvalidIcon, false, false, f alse, false, false); 80 testLinkRelAttribute("stylesheet import", true, InvalidIcon, false, false, f alse, false);
83 81
84 testLinkRelAttribute("preconnect", false, InvalidIcon, false, false, false, false, false, true); 82 testLinkRelAttribute("preconnect", false, InvalidIcon, false, false, false, false, true);
85 testLinkRelAttribute("pReCoNnEcT", false, InvalidIcon, false, false, false, false, false, true); 83 testLinkRelAttribute("pReCoNnEcT", false, InvalidIcon, false, false, false, false, true);
86 } 84 }
87 85
88 } // namespace blink 86 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698