Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(892)

Side by Side Diff: components/data_reduction_proxy/content/browser/content_lofi_decider_unittest.cc

Issue 2848293002: Adding the Previews infobar to pages that show a client LoFi image (Closed)
Patch Set: sclittle comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 776 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 base::FieldTrialList field_trial_list(nullptr); 787 base::FieldTrialList field_trial_list(nullptr);
788 base::FieldTrialList::CreateFieldTrial(params::GetLoFiFieldTrialName(), 788 base::FieldTrialList::CreateFieldTrial(params::GetLoFiFieldTrialName(),
789 "Enabled"); 789 "Enabled");
790 std::unique_ptr<net::URLRequest> request = 790 std::unique_ptr<net::URLRequest> request =
791 CreateRequest(false, content::PREVIEWS_NO_TRANSFORM); 791 CreateRequest(false, content::PREVIEWS_NO_TRANSFORM);
792 net::HttpRequestHeaders headers; 792 net::HttpRequestHeaders headers;
793 NotifyBeforeSendHeaders(&headers, request.get(), true); 793 NotifyBeforeSendHeaders(&headers, request.get(), true);
794 EXPECT_FALSE(headers.HasHeader(chrome_proxy_accept_transform_header())); 794 EXPECT_FALSE(headers.HasHeader(chrome_proxy_accept_transform_header()));
795 } 795 }
796 796
797 TEST_F(ContentLoFiDeciderTest, RequestIsClientSideLoFiMainFrameTest) {
798 std::unique_ptr<net::URLRequest> request = CreateRequestByType(
799 content::RESOURCE_TYPE_MAIN_FRAME, true, content::CLIENT_LOFI_ON);
sclittle 2017/05/03 22:51:29 nit: Could we also have a test for when it's an im
RyanSturm 2017/05/03 23:20:30 Done.
800 std::unique_ptr<data_reduction_proxy::ContentLoFiDecider> lofi_decider(
801 new data_reduction_proxy::ContentLoFiDecider());
802 EXPECT_FALSE(lofi_decider->IsClientLoFiImageRequest(*request));
803 }
804
805 TEST_F(ContentLoFiDeciderTest, RequestIsClientSideLoFiImageTest) {
806 std::unique_ptr<net::URLRequest> request = CreateRequestByType(
807 content::RESOURCE_TYPE_IMAGE, true, content::CLIENT_LOFI_ON);
808 std::unique_ptr<data_reduction_proxy::ContentLoFiDecider> lofi_decider(
809 new data_reduction_proxy::ContentLoFiDecider());
810 EXPECT_TRUE(lofi_decider->IsClientLoFiImageRequest(*request));
811 }
812
797 } // namespace data_reduction_proxy 813 } // namespace data_reduction_proxy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698