| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 documentLoader = DocumentLoader::create(&dummyPageHolder->frame(), Resou
rceRequest("http://www.example.com"), SubstituteData()); | 232 documentLoader = DocumentLoader::create(&dummyPageHolder->frame(), Resou
rceRequest("http://www.example.com"), SubstituteData()); |
| 233 document = toHTMLDocument(&dummyPageHolder->document()); | 233 document = toHTMLDocument(&dummyPageHolder->document()); |
| 234 fetcher = documentLoader->fetcher(); | 234 fetcher = documentLoader->fetcher(); |
| 235 static_cast<FrameFetchContext&>(fetcher->context()).setDocument(document
.get()); | 235 static_cast<FrameFetchContext&>(fetcher->context()).setDocument(document
.get()); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void expectHeader(const char* input, const char* headerName, bool isPresent,
const char* headerValue) | 238 void expectHeader(const char* input, const char* headerName, bool isPresent,
const char* headerValue) |
| 239 { | 239 { |
| 240 KURL inputURL(ParsedURLString, input); | 240 KURL inputURL(ParsedURLString, input); |
| 241 FetchRequest fetchRequest = FetchRequest(ResourceRequest(inputURL), Fetc
hInitiatorInfo()); | 241 FetchRequest fetchRequest = FetchRequest(ResourceRequest(inputURL), Fetc
hInitiatorInfo()); |
| 242 fetcher->addClientHintsIfNeccessary(fetchRequest); | 242 fetcher->addClientHintsIfNecessary(fetchRequest); |
| 243 | 243 |
| 244 EXPECT_STREQ(isPresent ? headerValue : "", | 244 EXPECT_STREQ(isPresent ? headerValue : "", |
| 245 fetchRequest.resourceRequest().httpHeaderField(headerName).utf8().da
ta()); | 245 fetchRequest.resourceRequest().httpHeaderField(headerName).utf8().da
ta()); |
| 246 } | 246 } |
| 247 | 247 |
| 248 OwnPtr<DummyPageHolder> dummyPageHolder; | 248 OwnPtr<DummyPageHolder> dummyPageHolder; |
| 249 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long | 249 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long |
| 250 // as the ResourceFetcher and Document live due to indirect usage. | 250 // as the ResourceFetcher and Document live due to indirect usage. |
| 251 RefPtr<DocumentLoader> documentLoader; | 251 RefPtr<DocumentLoader> documentLoader; |
| 252 RefPtrWillBePersistent<Document> document; | 252 RefPtrWillBePersistent<Document> document; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 279 expectHeader("http://www.example.com/1.gif", "DPR", false, ""); | 279 expectHeader("http://www.example.com/1.gif", "DPR", false, ""); |
| 280 expectHeader("http://www.example.com/1.gif", "RW", false, ""); | 280 expectHeader("http://www.example.com/1.gif", "RW", false, ""); |
| 281 | 281 |
| 282 dummyPageHolder->frame().setShouldSendDPRHint(); | 282 dummyPageHolder->frame().setShouldSendDPRHint(); |
| 283 dummyPageHolder->frame().setShouldSendRWHint(); | 283 dummyPageHolder->frame().setShouldSendRWHint(); |
| 284 expectHeader("http://www.example.com/1.gif", "DPR", true, "1"); | 284 expectHeader("http://www.example.com/1.gif", "DPR", true, "1"); |
| 285 expectHeader("http://www.example.com/1.gif", "RW", true, "500"); | 285 expectHeader("http://www.example.com/1.gif", "RW", true, "500"); |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace | 288 } // namespace |
| OLD | NEW |