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

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

Issue 1424503006: Page Serializer: Specify encoding for serialized CSS files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nfc-css
Patch Set: Created 5 years, 1 month 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, Opera Software ASA. All rights reserved. 2 * Copyright (c) 2013, Opera Software ASA. 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 EXPECT_TRUE(isSerialized("orange_background.png", "image/png")); 332 EXPECT_TRUE(isSerialized("orange_background.png", "image/png"));
333 EXPECT_TRUE(isSerialized("yellow_background.png", "image/png")); 333 EXPECT_TRUE(isSerialized("yellow_background.png", "image/png"));
334 EXPECT_TRUE(isSerialized("green_background.png", "image/png")); 334 EXPECT_TRUE(isSerialized("green_background.png", "image/png"));
335 EXPECT_TRUE(isSerialized("blue_background.png", "image/png")); 335 EXPECT_TRUE(isSerialized("blue_background.png", "image/png"));
336 EXPECT_TRUE(isSerialized("purple_background.png", "image/png")); 336 EXPECT_TRUE(isSerialized("purple_background.png", "image/png"));
337 EXPECT_TRUE(isSerialized("pink_background.png", "image/png")); 337 EXPECT_TRUE(isSerialized("pink_background.png", "image/png"));
338 EXPECT_TRUE(isSerialized("brown_background.png", "image/png")); 338 EXPECT_TRUE(isSerialized("brown_background.png", "image/png"));
339 EXPECT_TRUE(isSerialized("ul-dot.png", "image/png")); 339 EXPECT_TRUE(isSerialized("ul-dot.png", "image/png"));
340 EXPECT_TRUE(isSerialized("ol-dot.png", "image/png")); 340 EXPECT_TRUE(isSerialized("ol-dot.png", "image/png"));
341 341
342 // Ensure encodings are specified.
343 EXPECT_TRUE(getSerializedData("link_styles.css", "text/css").startsWith("@ch arset \"windows-1252\";"));
yosin_UTC9 2015/10/28 00:14:57 Does this work systems uses non-US locale? I'm not
jsbell 2015/10/28 18:16:55 Pretty sure it does; most of the Web is defined as
yosin_UTC9 2015/10/30 01:57:01 Since value of @charset for no @charset case isn't
344 EXPECT_TRUE(getSerializedData("import_styles.css", "text/css").startsWith("@ charset \"windows-1252\";"));
345 EXPECT_TRUE(getSerializedData("import_style_from_link.css", "text/css").star tsWith("@charset \"windows-1252\";"));
346 EXPECT_TRUE(getSerializedData("encoding.css", "text/css").startsWith("@chars et \"euc-kr\";"));
347
342 // Ensure that stylesheet contents are not NFC-normalized before encoding. 348 // Ensure that stylesheet contents are not NFC-normalized before encoding.
343 EXPECT_TRUE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC5 \xD1\xE2")); 349 EXPECT_TRUE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC5 \xD1\xE2"));
344 EXPECT_FALSE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC 5\xE4\xC5")); 350 EXPECT_FALSE(getSerializedData("encoding.css", "text/css").contains("\xE4\xC 5\xE4\xC5"));
345 } 351 }
346 352
347 TEST_F(PageSerializerTest, CSSImport) 353 TEST_F(PageSerializerTest, CSSImport)
348 { 354 {
349 setBaseFolder("pageserializer/css/"); 355 setBaseFolder("pageserializer/css/");
350 356
351 registerURL("import.html", "text/html"); 357 registerURL("import.html", "text/html");
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 EXPECT_EQ("saved from url=(0015)http://foo.com/", PageSerializer::markOfTheW ebDeclaration(KURL(ParsedURLString, "http://foo.com"))); 513 EXPECT_EQ("saved from url=(0015)http://foo.com/", PageSerializer::markOfTheW ebDeclaration(KURL(ParsedURLString, "http://foo.com")));
508 EXPECT_EQ("saved from url=(0015)http://f-o.com/", PageSerializer::markOfTheW ebDeclaration(KURL(ParsedURLString, "http://f-o.com"))); 514 EXPECT_EQ("saved from url=(0015)http://f-o.com/", PageSerializer::markOfTheW ebDeclaration(KURL(ParsedURLString, "http://f-o.com")));
509 EXPECT_EQ("saved from url=(0019)http://foo.com-%2D/", PageSerializer::markOf TheWebDeclaration(KURL(ParsedURLString, "http://foo.com--"))); 515 EXPECT_EQ("saved from url=(0019)http://foo.com-%2D/", PageSerializer::markOf TheWebDeclaration(KURL(ParsedURLString, "http://foo.com--")));
510 EXPECT_EQ("saved from url=(0024)http://f-%2D.com-%2D%3E/", PageSerializer::m arkOfTheWebDeclaration(KURL(ParsedURLString, "http://f--.com-->"))); 516 EXPECT_EQ("saved from url=(0024)http://f-%2D.com-%2D%3E/", PageSerializer::m arkOfTheWebDeclaration(KURL(ParsedURLString, "http://f--.com-->")));
511 EXPECT_EQ("saved from url=(0020)http://foo.com/?-%2D", PageSerializer::markO fTheWebDeclaration(KURL(ParsedURLString, "http://foo.com?--"))); 517 EXPECT_EQ("saved from url=(0020)http://foo.com/?-%2D", PageSerializer::markO fTheWebDeclaration(KURL(ParsedURLString, "http://foo.com?--")));
512 EXPECT_EQ("saved from url=(0020)http://foo.com/#-%2D", PageSerializer::markO fTheWebDeclaration(KURL(ParsedURLString, "http://foo.com#--"))); 518 EXPECT_EQ("saved from url=(0020)http://foo.com/#-%2D", PageSerializer::markO fTheWebDeclaration(KURL(ParsedURLString, "http://foo.com#--")));
513 EXPECT_EQ("saved from url=(0026)http://foo.com/#bar-%2Dbaz", PageSerializer: :markOfTheWebDeclaration(KURL(ParsedURLString, "http://foo.com#bar--baz"))); 519 EXPECT_EQ("saved from url=(0026)http://foo.com/#bar-%2Dbaz", PageSerializer: :markOfTheWebDeclaration(KURL(ParsedURLString, "http://foo.com#bar--baz")));
514 } 520 }
515 521
516 } // namespace blink 522 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698