OLD | NEW |
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 memoryCache()->add(oldResource.get()); | 73 memoryCache()->add(oldResource.get()); |
74 memoryCache()->remove(oldResource.get()); | 74 memoryCache()->remove(oldResource.get()); |
75 memoryCache()->add(newResource.get()); | 75 memoryCache()->add(newResource.get()); |
76 | 76 |
77 // Simulate a successful revalidation. | 77 // Simulate a successful revalidation. |
78 // The revalidated resource (oldResource) should now be in the cache, newRes
ource | 78 // The revalidated resource (oldResource) should now be in the cache, newRes
ource |
79 // should have been sliently switched to point to the revalidated resource,
and | 79 // should have been sliently switched to point to the revalidated resource,
and |
80 // we shouldn't hit any ASSERTs. | 80 // we shouldn't hit any ASSERTs. |
81 ResourceResponse response; | 81 ResourceResponse response; |
82 response.setHTTPStatusCode(304); | 82 response.setHTTPStatusCode(304); |
83 newResource->responseReceived(response); | 83 newResource->responseReceived(response, nullptr); |
84 EXPECT_EQ(memoryCache()->resourceForURL(KURL(ParsedURLString, "data:text/htm
l,")), oldResource.get()); | 84 EXPECT_EQ(memoryCache()->resourceForURL(KURL(ParsedURLString, "data:text/htm
l,")), oldResource.get()); |
85 EXPECT_EQ(oldResource.get(), newResource.get()); | 85 EXPECT_EQ(oldResource.get(), newResource.get()); |
86 EXPECT_NE(newResource.get(), newResourcePointer); | 86 EXPECT_NE(newResource.get(), newResourcePointer); |
87 } | 87 } |
88 | 88 |
89 class DummyClient : public RawResourceClient { | 89 class DummyClient : public RawResourceClient { |
90 public: | 90 public: |
91 DummyClient() : m_called(false) { } | 91 DummyClient() : m_called(false) { } |
92 virtual ~DummyClient() { } | 92 virtual ~DummyClient() { } |
93 | 93 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 OwnPtr<DummyClient> dummyClient = adoptPtr(new DummyClient()); | 182 OwnPtr<DummyClient> dummyClient = adoptPtr(new DummyClient()); |
183 OwnPtr<RemovingClient> removingClient = adoptPtr(new RemovingClient(dummyCli
ent.get())); | 183 OwnPtr<RemovingClient> removingClient = adoptPtr(new RemovingClient(dummyCli
ent.get())); |
184 raw->addClient(dummyClient.get()); | 184 raw->addClient(dummyClient.get()); |
185 raw->addClient(removingClient.get()); | 185 raw->addClient(removingClient.get()); |
186 testing::runPendingTasks(); | 186 testing::runPendingTasks(); |
187 EXPECT_FALSE(raw->hasClients()); | 187 EXPECT_FALSE(raw->hasClients()); |
188 } | 188 } |
189 | 189 |
190 } // namespace blink | 190 } // namespace blink |
OLD | NEW |