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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 EXPECT_EQ(ResourceLoadPriorityVeryLow, childFetchContext->modifyPriorityForE
xperiments(ResourceLoadPriorityMedium, Resource::Script, request, ResourcePriori
ty::NotVisible)); | 557 EXPECT_EQ(ResourceLoadPriorityVeryLow, childFetchContext->modifyPriorityForE
xperiments(ResourceLoadPriorityMedium, Resource::Script, request, ResourcePriori
ty::NotVisible)); |
558 } | 558 } |
559 | 559 |
560 TEST_F(FrameFetchContextTest, EnableDataSaver) | 560 TEST_F(FrameFetchContextTest, EnableDataSaver) |
561 { | 561 { |
562 Settings* settings = document->frame()->settings(); | 562 Settings* settings = document->frame()->settings(); |
563 settings->setDataSaverEnabled(true); | 563 settings->setDataSaverEnabled(true); |
564 ResourceRequest resourceRequest("http://www.example.com"); | 564 ResourceRequest resourceRequest("http://www.example.com"); |
565 fetchContext->addAdditionalRequestHeaders(resourceRequest, FetchMainResource
); | 565 fetchContext->addAdditionalRequestHeaders(resourceRequest, FetchMainResource
); |
566 EXPECT_STREQ("on", resourceRequest.httpHeaderField("Save-Data").utf8().data(
)); | 566 EXPECT_STREQ("on", resourceRequest.httpHeaderField("Save-Data").utf8().data(
)); |
| 567 |
| 568 // Subsequent call to addAdditionalRequestHeaders should not append to the |
| 569 // save-data header. |
| 570 fetchContext->addAdditionalRequestHeaders(resourceRequest, FetchMainResource
); |
| 571 EXPECT_STREQ("on", resourceRequest.httpHeaderField("Save-Data").utf8().data(
)); |
567 } | 572 } |
568 | 573 |
569 TEST_F(FrameFetchContextTest, DisabledDataSaver) | 574 TEST_F(FrameFetchContextTest, DisabledDataSaver) |
570 { | 575 { |
571 ResourceRequest resourceRequest("http://www.example.com"); | 576 ResourceRequest resourceRequest("http://www.example.com"); |
572 fetchContext->addAdditionalRequestHeaders(resourceRequest, FetchMainResource
); | 577 fetchContext->addAdditionalRequestHeaders(resourceRequest, FetchMainResource
); |
573 EXPECT_STREQ("", resourceRequest.httpHeaderField("Save-Data").utf8().data())
; | 578 EXPECT_STREQ("", resourceRequest.httpHeaderField("Save-Data").utf8().data())
; |
574 } | 579 } |
575 | 580 |
576 // Tests that when a resource with certificate errors is loaded from the | 581 // Tests that when a resource with certificate errors is loaded from the |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource
); | 728 fetchContext->addAdditionalRequestHeaders(mainRequest, FetchMainResource
); |
724 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); | 729 EXPECT_EQ(mainRequest.isExternalRequest(), test.isExternalExpectation); |
725 | 730 |
726 ResourceRequest subRequest(test.url); | 731 ResourceRequest subRequest(test.url); |
727 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); | 732 fetchContext->addAdditionalRequestHeaders(subRequest, FetchSubresource); |
728 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); | 733 EXPECT_EQ(subRequest.isExternalRequest(), test.isExternalExpectation); |
729 } | 734 } |
730 } | 735 } |
731 | 736 |
732 } // namespace blink | 737 } // namespace blink |
OLD | NEW |