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

Side by Side Diff: third_party/WebKit/Source/core/fetch/RawResourceTest.cpp

Issue 2649853003: Make Resource::setResponse() private
Patch Set: Rebase Created 3 years, 11 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 EXPECT_FALSE(resource->isAlive()); 399 EXPECT_FALSE(resource->isAlive());
400 } 400 }
401 401
402 TEST(RawResourceTest, AddClientDuringCallback) { 402 TEST(RawResourceTest, AddClientDuringCallback) {
403 Resource* raw = 403 Resource* raw =
404 RawResource::create(ResourceRequest("data:text/html,"), Resource::Raw); 404 RawResource::create(ResourceRequest("data:text/html,"), Resource::Raw);
405 405
406 // Create a non-null response. 406 // Create a non-null response.
407 ResourceResponse response = raw->response(); 407 ResourceResponse response = raw->response();
408 response.setURL(KURL(ParsedURLString, "http://600.613/")); 408 response.setURL(KURL(ParsedURLString, "http://600.613/"));
409 raw->setResponse(response); 409 raw->responseReceived(response, nullptr);
410 raw->finish(); 410 raw->finish();
411 EXPECT_FALSE(raw->response().isNull()); 411 EXPECT_FALSE(raw->response().isNull());
412 412
413 Persistent<DummyClient> dummyClient = new DummyClient(); 413 Persistent<DummyClient> dummyClient = new DummyClient();
414 Persistent<AddingClient> addingClient = 414 Persistent<AddingClient> addingClient =
415 new AddingClient(dummyClient.get(), raw); 415 new AddingClient(dummyClient.get(), raw);
416 raw->addClient(addingClient); 416 raw->addClient(addingClient);
417 testing::runPendingTasks(); 417 testing::runPendingTasks();
418 raw->removeClient(addingClient); 418 raw->removeClient(addingClient);
419 EXPECT_FALSE(dummyClient->called()); 419 EXPECT_FALSE(dummyClient->called());
(...skipping 25 matching lines...) Expand all
445 Member<DummyClient> m_dummyClient; 445 Member<DummyClient> m_dummyClient;
446 }; 446 };
447 447
448 TEST(RawResourceTest, RemoveClientDuringCallback) { 448 TEST(RawResourceTest, RemoveClientDuringCallback) {
449 Resource* raw = 449 Resource* raw =
450 RawResource::create(ResourceRequest("data:text/html,"), Resource::Raw); 450 RawResource::create(ResourceRequest("data:text/html,"), Resource::Raw);
451 451
452 // Create a non-null response. 452 // Create a non-null response.
453 ResourceResponse response = raw->response(); 453 ResourceResponse response = raw->response();
454 response.setURL(KURL(ParsedURLString, "http://600.613/")); 454 response.setURL(KURL(ParsedURLString, "http://600.613/"));
455 raw->setResponse(response); 455 raw->responseReceived(response, nullptr);
456 raw->finish(); 456 raw->finish();
457 EXPECT_FALSE(raw->response().isNull()); 457 EXPECT_FALSE(raw->response().isNull());
458 458
459 Persistent<DummyClient> dummyClient = new DummyClient(); 459 Persistent<DummyClient> dummyClient = new DummyClient();
460 Persistent<RemovingClient> removingClient = 460 Persistent<RemovingClient> removingClient =
461 new RemovingClient(dummyClient.get()); 461 new RemovingClient(dummyClient.get());
462 raw->addClient(dummyClient); 462 raw->addClient(dummyClient);
463 raw->addClient(removingClient); 463 raw->addClient(removingClient);
464 testing::runPendingTasks(); 464 testing::runPendingTasks();
465 EXPECT_FALSE(raw->isAlive()); 465 EXPECT_FALSE(raw->isAlive());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 558
559 TEST(RawResourceTest, CanReuseDevToolsEmulateNetworkConditionsClientIdHeader) { 559 TEST(RawResourceTest, CanReuseDevToolsEmulateNetworkConditionsClientIdHeader) {
560 ResourceRequest request("data:text/html,"); 560 ResourceRequest request("data:text/html,");
561 request.setHTTPHeaderField( 561 request.setHTTPHeaderField(
562 HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id, "Foo"); 562 HTTPNames::X_DevTools_Emulate_Network_Conditions_Client_Id, "Foo");
563 Resource* raw = RawResource::create(request, Resource::Raw); 563 Resource* raw = RawResource::create(request, Resource::Raw);
564 EXPECT_TRUE(raw->canReuse(ResourceRequest("data:text/html,"))); 564 EXPECT_TRUE(raw->canReuse(ResourceRequest("data:text/html,")));
565 } 565 }
566 566
567 } // namespace blink 567 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/RawResource.h ('k') | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698