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

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

Issue 2191533003: Refactor Timer classes in preparation for landing FrameTimers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More build fixes Created 4 years, 4 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/fetch/RawResource.h" 31 #include "core/fetch/RawResource.h"
32 32
33 #include "core/fetch/MemoryCache.h" 33 #include "core/fetch/MemoryCache.h"
34 #include "core/fetch/ResourceFetcher.h" 34 #include "core/fetch/ResourceFetcher.h"
35 #include "platform/SharedBuffer.h" 35 #include "platform/SharedBuffer.h"
36 #include "platform/heap/Handle.h" 36 #include "platform/heap/Handle.h"
37 #include "platform/testing/UnitTestHelpers.h" 37 #include "platform/testing/UnitTestHelpers.h"
38 #include "public/platform/Platform.h" 38 #include "public/platform/Platform.h"
39 #include "public/platform/WebScheduler.h"
40 #include "public/platform/WebThread.h"
39 #include "public/platform/WebURL.h" 41 #include "public/platform/WebURL.h"
40 #include "public/platform/WebURLResponse.h" 42 #include "public/platform/WebURLResponse.h"
41 #include "testing/gtest/include/gtest/gtest.h" 43 #include "testing/gtest/include/gtest/gtest.h"
42 44
43 namespace blink { 45 namespace blink {
44 46
45 TEST(RawResourceTest, DontIgnoreAcceptForCacheReuse) 47 TEST(RawResourceTest, DontIgnoreAcceptForCacheReuse)
46 { 48 {
47 ResourceRequest jpegRequest; 49 ResourceRequest jpegRequest;
48 jpegRequest.setHTTPAccept("image/jpeg"); 50 jpegRequest.setHTTPAccept("image/jpeg");
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // ResourceClient implementation. 103 // ResourceClient implementation.
102 void notifyFinished(Resource* resource) override 104 void notifyFinished(Resource* resource) override
103 { 105 {
104 // First schedule an asynchronous task to remove the client. 106 // First schedule an asynchronous task to remove the client.
105 // We do not expect the client to be called. 107 // We do not expect the client to be called.
106 m_removeClientTimer.startOneShot(0, BLINK_FROM_HERE); 108 m_removeClientTimer.startOneShot(0, BLINK_FROM_HERE);
107 resource->addClient(m_dummyClient); 109 resource->addClient(m_dummyClient);
108 } 110 }
109 String debugName() const override { return "AddingClient"; } 111 String debugName() const override { return "AddingClient"; }
110 112
111 void removeClient(Timer<AddingClient>* timer) 113 void removeClient(TimerBase* timer)
112 { 114 {
113 m_resource->removeClient(m_dummyClient); 115 m_resource->removeClient(m_dummyClient);
114 } 116 }
115 117
116 DEFINE_INLINE_VIRTUAL_TRACE() 118 DEFINE_INLINE_VIRTUAL_TRACE()
117 { 119 {
118 visitor->trace(m_dummyClient); 120 visitor->trace(m_dummyClient);
119 visitor->trace(m_resource); 121 visitor->trace(m_resource);
120 } 122 }
121 123
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 392
391 TEST(RawResourceTest, CanReuseDevToolsEmulateNetworkConditionsClientIdHeader) 393 TEST(RawResourceTest, CanReuseDevToolsEmulateNetworkConditionsClientIdHeader)
392 { 394 {
393 ResourceRequest request("data:text/html,"); 395 ResourceRequest request("data:text/html,");
394 request.setHTTPHeaderField(HTTPNames::X_DevTools_Emulate_Network_Conditions_ Client_Id, "Foo"); 396 request.setHTTPHeaderField(HTTPNames::X_DevTools_Emulate_Network_Conditions_ Client_Id, "Foo");
395 Resource* raw = RawResource::create(request, Resource::Raw); 397 Resource* raw = RawResource::create(request, Resource::Raw);
396 EXPECT_TRUE(raw->canReuse(ResourceRequest("data:text/html,"))); 398 EXPECT_TRUE(raw->canReuse(ResourceRequest("data:text/html,")));
397 } 399 }
398 400
399 } // namespace blink 401 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MemoryCache.cpp ('k') | third_party/WebKit/Source/core/fetch/Resource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698