OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h
" | 5 #include "components/data_reduction_proxy/content/browser/content_lofi_decider.h
" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 } | 811 } |
812 | 812 |
813 TEST_F(ContentLoFiDeciderTest, RequestIsClientSideLoFiImageTest) { | 813 TEST_F(ContentLoFiDeciderTest, RequestIsClientSideLoFiImageTest) { |
814 std::unique_ptr<net::URLRequest> request = CreateRequestByType( | 814 std::unique_ptr<net::URLRequest> request = CreateRequestByType( |
815 content::RESOURCE_TYPE_IMAGE, true, content::CLIENT_LOFI_ON); | 815 content::RESOURCE_TYPE_IMAGE, true, content::CLIENT_LOFI_ON); |
816 std::unique_ptr<data_reduction_proxy::ContentLoFiDecider> lofi_decider( | 816 std::unique_ptr<data_reduction_proxy::ContentLoFiDecider> lofi_decider( |
817 new data_reduction_proxy::ContentLoFiDecider()); | 817 new data_reduction_proxy::ContentLoFiDecider()); |
818 EXPECT_TRUE(lofi_decider->IsClientLoFiImageRequest(*request)); | 818 EXPECT_TRUE(lofi_decider->IsClientLoFiImageRequest(*request)); |
819 } | 819 } |
820 | 820 |
| 821 TEST_F(ContentLoFiDeciderTest, RequestIsClientLoFiAutoReload) { |
| 822 // IsClientLoFiAutoReloadRequest() should return true for any request with the |
| 823 // CLIENT_LOFI_AUTO_RELOAD bit set. |
| 824 |
| 825 EXPECT_TRUE(ContentLoFiDecider().IsClientLoFiAutoReloadRequest( |
| 826 *CreateRequestByType(content::RESOURCE_TYPE_IMAGE, false, |
| 827 content::CLIENT_LOFI_AUTO_RELOAD))); |
| 828 |
| 829 EXPECT_TRUE( |
| 830 ContentLoFiDecider().IsClientLoFiAutoReloadRequest(*CreateRequestByType( |
| 831 content::RESOURCE_TYPE_IMAGE, true, |
| 832 content::CLIENT_LOFI_AUTO_RELOAD | content::PREVIEWS_NO_TRANSFORM))); |
| 833 |
| 834 EXPECT_TRUE(ContentLoFiDecider().IsClientLoFiAutoReloadRequest( |
| 835 *CreateRequestByType(content::RESOURCE_TYPE_MAIN_FRAME, true, |
| 836 content::CLIENT_LOFI_AUTO_RELOAD))); |
| 837 |
| 838 EXPECT_TRUE(ContentLoFiDecider().IsClientLoFiAutoReloadRequest( |
| 839 *CreateRequestByType(content::RESOURCE_TYPE_SCRIPT, true, |
| 840 content::CLIENT_LOFI_AUTO_RELOAD))); |
| 841 |
| 842 // IsClientLoFiAutoReloadRequest() should return false for any request without |
| 843 // the CLIENT_LOFI_AUTO_RELOAD bit set. |
| 844 EXPECT_FALSE(ContentLoFiDecider().IsClientLoFiAutoReloadRequest( |
| 845 *CreateRequestByType(content::RESOURCE_TYPE_IMAGE, false, |
| 846 content::PREVIEWS_NO_TRANSFORM))); |
| 847 } |
| 848 |
821 } // namespace data_reduction_proxy | 849 } // namespace data_reduction_proxy |
OLD | NEW |