| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015, Google Inc. All rights reserved. | 2 * Copyright (c) 2015, 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 fetchRequest.mutableResourceRequest().setFrameType(frameType); | 78 fetchRequest.mutableResourceRequest().setFrameType(frameType); |
| 79 | 79 |
| 80 fetchContext->upgradeInsecureRequest(fetchRequest); | 80 fetchContext->upgradeInsecureRequest(fetchRequest); |
| 81 | 81 |
| 82 EXPECT_STREQ(expectedURL.string().utf8().data(), fetchRequest.resourceRe
quest().url().string().utf8().data()); | 82 EXPECT_STREQ(expectedURL.string().utf8().data(), fetchRequest.resourceRe
quest().url().string().utf8().data()); |
| 83 EXPECT_EQ(expectedURL.protocol(), fetchRequest.resourceRequest().url().p
rotocol()); | 83 EXPECT_EQ(expectedURL.protocol(), fetchRequest.resourceRequest().url().p
rotocol()); |
| 84 EXPECT_EQ(expectedURL.host(), fetchRequest.resourceRequest().url().host(
)); | 84 EXPECT_EQ(expectedURL.host(), fetchRequest.resourceRequest().url().host(
)); |
| 85 EXPECT_EQ(expectedURL.port(), fetchRequest.resourceRequest().url().port(
)); | 85 EXPECT_EQ(expectedURL.port(), fetchRequest.resourceRequest().url().port(
)); |
| 86 EXPECT_EQ(expectedURL.hasPort(), fetchRequest.resourceRequest().url().ha
sPort()); | 86 EXPECT_EQ(expectedURL.hasPort(), fetchRequest.resourceRequest().url().ha
sPort()); |
| 87 EXPECT_EQ(expectedURL.path(), fetchRequest.resourceRequest().url().path(
)); | 87 EXPECT_EQ(expectedURL.path(), fetchRequest.resourceRequest().url().path(
)); |
| 88 |
| 89 bool expectUpgrade = inputURL != expectedURL; |
| 90 |
| 91 EXPECT_STREQ(expectUpgrade ? "1" : "", |
| 92 fetchRequest.resourceRequest().httpHeaderField("Upgraded").utf8().da
ta()); |
| 88 } | 93 } |
| 89 | 94 |
| 90 void expectPreferHeader(const char* input, WebURLRequest::FrameType frameTyp
e, bool shouldPrefer) | 95 void expectPreferHeader(const char* input, WebURLRequest::FrameType frameTyp
e, bool shouldPrefer) |
| 91 { | 96 { |
| 92 KURL inputURL(ParsedURLString, input); | 97 KURL inputURL(ParsedURLString, input); |
| 93 | 98 |
| 94 FetchRequest fetchRequest = FetchRequest(ResourceRequest(inputURL), Fetc
hInitiatorInfo()); | 99 FetchRequest fetchRequest = FetchRequest(ResourceRequest(inputURL), Fetc
hInitiatorInfo()); |
| 95 fetchRequest.mutableResourceRequest().setRequestContext(WebURLRequest::R
equestContextScript); | 100 fetchRequest.mutableResourceRequest().setRequestContext(WebURLRequest::R
equestContextScript); |
| 96 fetchRequest.mutableResourceRequest().setFrameType(frameType); | 101 fetchRequest.mutableResourceRequest().setFrameType(frameType); |
| 97 | 102 |
| 98 fetchContext->upgradeInsecureRequest(fetchRequest); | 103 fetchContext->upgradeInsecureRequest(fetchRequest); |
| 99 | 104 |
| 100 EXPECT_STREQ(shouldPrefer ? "return=secure-representation" : "", | 105 EXPECT_STREQ(shouldPrefer ? "tls" : "", |
| 101 fetchRequest.resourceRequest().httpHeaderField("Prefer").utf8().data
()); | 106 fetchRequest.resourceRequest().httpHeaderField("Prefer").utf8().data
()); |
| 102 } | 107 } |
| 103 | 108 |
| 104 KURL secureURL; | 109 KURL secureURL; |
| 105 RefPtr<SecurityOrigin> exampleOrigin; | 110 RefPtr<SecurityOrigin> exampleOrigin; |
| 106 RefPtr<SecurityOrigin> secureOrigin; | 111 RefPtr<SecurityOrigin> secureOrigin; |
| 107 | 112 |
| 108 OwnPtr<DummyPageHolder> dummyPageHolder; | 113 OwnPtr<DummyPageHolder> dummyPageHolder; |
| 109 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long | 114 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long |
| 110 // as the ResourceFetcher and Document live due to indirect usage. | 115 // as the ResourceFetcher and Document live due to indirect usage. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 expectHeader("http://www.example.com/1.gif", "RW", false, ""); | 266 expectHeader("http://www.example.com/1.gif", "RW", false, ""); |
| 262 | 267 |
| 263 dummyPageHolder->frame().setShouldSendDPRHint(); | 268 dummyPageHolder->frame().setShouldSendDPRHint(); |
| 264 dummyPageHolder->frame().setShouldSendRWHint(); | 269 dummyPageHolder->frame().setShouldSendRWHint(); |
| 265 expectHeader("http://www.example.com/1.gif", "DPR", true, "1"); | 270 expectHeader("http://www.example.com/1.gif", "DPR", true, "1"); |
| 266 expectHeader("http://www.example.com/1.gif", "RW", true, "500"); | 271 expectHeader("http://www.example.com/1.gif", "RW", true, "500"); |
| 267 } | 272 } |
| 268 | 273 |
| 269 } // namespace | 274 } // namespace |
| 270 | 275 |
| OLD | NEW |