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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 fetchRequest.resourceRequest().httpHeaderField("HTTPS").utf8().data(
)); | 101 fetchRequest.resourceRequest().httpHeaderField("HTTPS").utf8().data(
)); |
102 } | 102 } |
103 | 103 |
104 KURL secureURL; | 104 KURL secureURL; |
105 RefPtr<SecurityOrigin> exampleOrigin; | 105 RefPtr<SecurityOrigin> exampleOrigin; |
106 RefPtr<SecurityOrigin> secureOrigin; | 106 RefPtr<SecurityOrigin> secureOrigin; |
107 | 107 |
108 OwnPtr<DummyPageHolder> dummyPageHolder; | 108 OwnPtr<DummyPageHolder> dummyPageHolder; |
109 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long | 109 // 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. | 110 // as the ResourceFetcher and Document live due to indirect usage. |
111 RefPtr<DocumentLoader> documentLoader; | 111 RefPtrWillBePersistent<DocumentLoader> documentLoader; |
112 RefPtrWillBePersistent<Document> document; | 112 RefPtrWillBePersistent<Document> document; |
113 FetchContext* fetchContext; | 113 FetchContext* fetchContext; |
114 }; | 114 }; |
115 | 115 |
116 TEST_F(FrameFetchContextUpgradeTest, UpgradeInsecureResourceRequests) | 116 TEST_F(FrameFetchContextUpgradeTest, UpgradeInsecureResourceRequests) |
117 { | 117 { |
118 struct TestCase { | 118 struct TestCase { |
119 const char* original; | 119 const char* original; |
120 const char* upgraded; | 120 const char* upgraded; |
121 } tests[] = { | 121 } tests[] = { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 } | 242 } |
243 fetchContext->addClientHintsIfNecessary(fetchRequest); | 243 fetchContext->addClientHintsIfNecessary(fetchRequest); |
244 | 244 |
245 EXPECT_STREQ(isPresent ? headerValue : "", | 245 EXPECT_STREQ(isPresent ? headerValue : "", |
246 fetchRequest.resourceRequest().httpHeaderField(headerName).utf8().da
ta()); | 246 fetchRequest.resourceRequest().httpHeaderField(headerName).utf8().da
ta()); |
247 } | 247 } |
248 | 248 |
249 OwnPtr<DummyPageHolder> dummyPageHolder; | 249 OwnPtr<DummyPageHolder> dummyPageHolder; |
250 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long | 250 // We don't use the DocumentLoader directly in any tests, but need to keep i
t around as long |
251 // as the ResourceFetcher and Document live due to indirect usage. | 251 // as the ResourceFetcher and Document live due to indirect usage. |
252 RefPtr<DocumentLoader> documentLoader; | 252 RefPtrWillBePersistent<DocumentLoader> documentLoader; |
253 RefPtrWillBePersistent<Document> document; | 253 RefPtrWillBePersistent<Document> document; |
254 FetchContext* fetchContext; | 254 FetchContext* fetchContext; |
255 }; | 255 }; |
256 | 256 |
257 TEST_F(FrameFetchContextHintsTest, MonitorDPRHints) | 257 TEST_F(FrameFetchContextHintsTest, MonitorDPRHints) |
258 { | 258 { |
259 expectHeader("http://www.example.com/1.gif", "DPR", false, ""); | 259 expectHeader("http://www.example.com/1.gif", "DPR", false, ""); |
260 ClientHintsPreferences preferences; | 260 ClientHintsPreferences preferences; |
261 preferences.setShouldSendDPR(true); | 261 preferences.setShouldSendDPR(true); |
262 document->setClientHintsPreferences(preferences); | 262 document->setClientHintsPreferences(preferences); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 preferences.setShouldSendDPR(true); | 302 preferences.setShouldSendDPR(true); |
303 preferences.setShouldSendResourceWidth(true); | 303 preferences.setShouldSendResourceWidth(true); |
304 preferences.setShouldSendViewportWidth(true); | 304 preferences.setShouldSendViewportWidth(true); |
305 document->setClientHintsPreferences(preferences); | 305 document->setClientHintsPreferences(preferences); |
306 expectHeader("http://www.example.com/1.gif", "DPR", true, "1"); | 306 expectHeader("http://www.example.com/1.gif", "DPR", true, "1"); |
307 expectHeader("http://www.example.com/1.gif", "Width", true, "400", 400); | 307 expectHeader("http://www.example.com/1.gif", "Width", true, "400", 400); |
308 expectHeader("http://www.example.com/1.gif", "Viewport-Width", true, "500"); | 308 expectHeader("http://www.example.com/1.gif", "Viewport-Width", true, "500"); |
309 } | 309 } |
310 | 310 |
311 } // namespace | 311 } // namespace |
312 | |
OLD | NEW |