OLD | NEW |
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 Resource* resource = Resource::create(request, type); | 111 Resource* resource = Resource::create(request, type); |
112 resource->setResponse(ResourceResponse(KURL(ParsedURLString, kResourceURL), | 112 resource->setResponse(ResourceResponse(KURL(ParsedURLString, kResourceURL), |
113 "text/html", 0, nullAtom, String())); | 113 "text/html", 0, nullAtom, String())); |
114 resource->finish(); | 114 resource->finish(); |
115 memoryCache()->add(resource); | 115 memoryCache()->add(resource); |
116 | 116 |
117 return resource; | 117 return resource; |
118 } | 118 } |
119 | 119 |
120 Resource* fetch() { | 120 Resource* fetch() { |
121 FetchRequest fetchRequest( | 121 ResourceRequest resourceRequest(KURL(ParsedURLString, kResourceURL)); |
122 ResourceRequest(KURL(ParsedURLString, kResourceURL)), | 122 resourceRequest.setRequestContext(WebURLRequest::RequestContextInternal); |
123 FetchInitiatorInfo()); | 123 FetchRequest fetchRequest(resourceRequest, FetchInitiatorInfo()); |
124 return RawResource::fetchSynchronously(fetchRequest, fetcher()); | 124 return RawResource::fetch(fetchRequest, fetcher()); |
125 } | 125 } |
126 | 126 |
127 Resource* fetchImage() { | 127 Resource* fetchImage() { |
128 FetchRequest fetchRequest( | 128 FetchRequest fetchRequest( |
129 ResourceRequest(KURL(ParsedURLString, kResourceURL)), | 129 ResourceRequest(KURL(ParsedURLString, kResourceURL)), |
130 FetchInitiatorInfo()); | 130 FetchInitiatorInfo()); |
131 return ImageResource::fetch(fetchRequest, fetcher()); | 131 return ImageResource::fetch(fetchRequest, fetcher()); |
132 } | 132 } |
133 | 133 |
134 ResourceFetcher* fetcher() const { return m_fetcher.get(); } | 134 ResourceFetcher* fetcher() const { return m_fetcher.get(); } |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 firstResource->finish(); | 602 firstResource->finish(); |
603 memoryCache()->add(firstResource); | 603 memoryCache()->add(firstResource); |
604 | 604 |
605 advanceClock(500.); | 605 advanceClock(500.); |
606 | 606 |
607 Resource* fetched = fetch(); | 607 Resource* fetched = fetch(); |
608 EXPECT_EQ(firstResource, fetched); | 608 EXPECT_EQ(firstResource, fetched); |
609 } | 609 } |
610 | 610 |
611 } // namespace blink | 611 } // namespace blink |
OLD | NEW |