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

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

Issue 2384033002: reflow comments in web/tests (Closed)
Patch Set: comments (heh!) Created 4 years, 2 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) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 SecurityOrigin* origin = document->getSecurityOrigin(); 203 SecurityOrigin* origin = document->getSecurityOrigin();
204 EXPECT_STRNE("localhost", origin->domain().ascii().data()); 204 EXPECT_STRNE("localhost", origin->domain().ascii().data());
205 } 205 }
206 206
207 TEST_F(MHTMLTest, TestMHTMLEncoding) { 207 TEST_F(MHTMLTest, TestMHTMLEncoding) {
208 addTestResources(); 208 addTestResources();
209 RefPtr<SharedBuffer> data = serialize("Test Serialization", "text/html", 209 RefPtr<SharedBuffer> data = serialize("Test Serialization", "text/html",
210 MHTMLArchive::UseDefaultEncoding); 210 MHTMLArchive::UseDefaultEncoding);
211 211
212 // Read the MHTML data line per line and do some pseudo-parsing to make sure t he right encoding is used for the different sections. 212 // Read the MHTML data line per line and do some pseudo-parsing to make sure
213 // the right encoding is used for the different sections.
213 LineReader lineReader(std::string(data->data(), data->size())); 214 LineReader lineReader(std::string(data->data(), data->size()));
214 int sectionCheckedCount = 0; 215 int sectionCheckedCount = 0;
215 const char* expectedEncoding = 0; 216 const char* expectedEncoding = 0;
216 std::string line; 217 std::string line;
217 while (lineReader.getNextLine(&line)) { 218 while (lineReader.getNextLine(&line)) {
218 if (line.compare(0, 13, "Content-Type:") == 0) { 219 if (line.compare(0, 13, "Content-Type:") == 0) {
219 ASSERT_FALSE(expectedEncoding); 220 ASSERT_FALSE(expectedEncoding);
220 if (line.find("multipart/related;") != std::string::npos) { 221 if (line.find("multipart/related;") != std::string::npos) {
221 // Skip this one, it's part of the MHTML header. 222 // Skip this one, it's part of the MHTML header.
222 continue; 223 continue;
(...skipping 18 matching lines...) Expand all
241 242
242 TEST_F(MHTMLTest, MHTMLFromScheme) { 243 TEST_F(MHTMLTest, MHTMLFromScheme) {
243 addTestResources(); 244 addTestResources();
244 RefPtr<SharedBuffer> data = serialize("Test Serialization", "text/html", 245 RefPtr<SharedBuffer> data = serialize("Test Serialization", "text/html",
245 MHTMLArchive::UseDefaultEncoding); 246 MHTMLArchive::UseDefaultEncoding);
246 KURL httpURL = toKURL("http://www.example.com"); 247 KURL httpURL = toKURL("http://www.example.com");
247 KURL contentURL = toKURL("content://foo"); 248 KURL contentURL = toKURL("content://foo");
248 KURL fileURL = toKURL("file://foo"); 249 KURL fileURL = toKURL("file://foo");
249 KURL specialSchemeURL = toKURL("fooscheme://bar"); 250 KURL specialSchemeURL = toKURL("fooscheme://bar");
250 251
251 // MHTMLArchives can only be initialized from local schemes, http/https scheme s, and content scheme(Android specific). 252 // MHTMLArchives can only be initialized from local schemes, http/https
253 // schemes, and content scheme(Android specific).
252 EXPECT_NE(nullptr, MHTMLArchive::create(httpURL, data.get())); 254 EXPECT_NE(nullptr, MHTMLArchive::create(httpURL, data.get()));
253 #if OS(ANDROID) 255 #if OS(ANDROID)
254 EXPECT_NE(nullptr, MHTMLArchive::create(contentURL, data.get())); 256 EXPECT_NE(nullptr, MHTMLArchive::create(contentURL, data.get()));
255 #else 257 #else
256 EXPECT_EQ(nullptr, MHTMLArchive::create(contentURL, data.get())); 258 EXPECT_EQ(nullptr, MHTMLArchive::create(contentURL, data.get()));
257 #endif 259 #endif
258 EXPECT_NE(nullptr, MHTMLArchive::create(fileURL, data.get())); 260 EXPECT_NE(nullptr, MHTMLArchive::create(fileURL, data.get()));
259 EXPECT_EQ(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); 261 EXPECT_EQ(nullptr, MHTMLArchive::create(specialSchemeURL, data.get()));
260 SchemeRegistry::registerURLSchemeAsLocal("fooscheme"); 262 SchemeRegistry::registerURLSchemeAsLocal("fooscheme");
261 EXPECT_NE(nullptr, MHTMLArchive::create(specialSchemeURL, data.get())); 263 EXPECT_NE(nullptr, MHTMLArchive::create(specialSchemeURL, data.get()));
(...skipping 15 matching lines...) Expand all
277 // Full sandboxing should be turned on. 279 // Full sandboxing should be turned on.
278 EXPECT_TRUE(document->isSandboxed(SandboxAll)); 280 EXPECT_TRUE(document->isSandboxed(SandboxAll));
279 281
280 // MHTML document should be loaded into unique origin. 282 // MHTML document should be loaded into unique origin.
281 EXPECT_TRUE(document->getSecurityOrigin()->isUnique()); 283 EXPECT_TRUE(document->getSecurityOrigin()->isUnique());
282 // Script execution should be disabled. 284 // Script execution should be disabled.
283 EXPECT_FALSE(frame->script().canExecuteScripts(NotAboutToExecuteScript)); 285 EXPECT_FALSE(frame->script().canExecuteScripts(NotAboutToExecuteScript));
284 } 286 }
285 287
286 } // namespace blink 288 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/LinkSelectionTest.cpp ('k') | third_party/WebKit/Source/web/tests/PrerenderingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698