| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/android/offline_pages/offline_page_request_job.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_request_job.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 class TestPreviewsDecider : public previews::PreviewsDecider { | 186 class TestPreviewsDecider : public previews::PreviewsDecider { |
| 187 public: | 187 public: |
| 188 TestPreviewsDecider() : should_allow_preview_(false) {} | 188 TestPreviewsDecider() : should_allow_preview_(false) {} |
| 189 ~TestPreviewsDecider() override {} | 189 ~TestPreviewsDecider() override {} |
| 190 | 190 |
| 191 bool ShouldAllowPreview(const net::URLRequest& request, | 191 bool ShouldAllowPreview(const net::URLRequest& request, |
| 192 previews::PreviewsType type) const override { | 192 previews::PreviewsType type) const override { |
| 193 return should_allow_preview_; | 193 return should_allow_preview_; |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool ShouldAllowPreviewAtECT( |
| 197 const net::URLRequest& request, |
| 198 previews::PreviewsType type, |
| 199 net::EffectiveConnectionType effective_connection_type_threshold) |
| 200 const override { |
| 201 return should_allow_preview_; |
| 202 } |
| 203 |
| 196 void set_should_allow_preview(bool should_allow_preview) { | 204 void set_should_allow_preview(bool should_allow_preview) { |
| 197 should_allow_preview_ = should_allow_preview; | 205 should_allow_preview_ = should_allow_preview; |
| 198 } | 206 } |
| 199 | 207 |
| 200 private: | 208 private: |
| 201 bool should_allow_preview_; | 209 bool should_allow_preview_; |
| 202 | 210 |
| 203 DISALLOW_COPY_AND_ASSIGN(TestPreviewsDecider); | 211 DISALLOW_COPY_AND_ASSIGN(TestPreviewsDecider); |
| 204 }; | 212 }; |
| 205 | 213 |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 ASSERT_TRUE(offline_page_tab_helper()->GetOfflinePageForTest()); | 905 ASSERT_TRUE(offline_page_tab_helper()->GetOfflinePageForTest()); |
| 898 EXPECT_EQ(offline_id4(), | 906 EXPECT_EQ(offline_id4(), |
| 899 offline_page_tab_helper()->GetOfflinePageForTest()->offline_id); | 907 offline_page_tab_helper()->GetOfflinePageForTest()->offline_id); |
| 900 ExpectOneUniqueSampleForAggregatedRequestResult( | 908 ExpectOneUniqueSampleForAggregatedRequestResult( |
| 901 OfflinePageRequestJob::AggregatedRequestResult:: | 909 OfflinePageRequestJob::AggregatedRequestResult:: |
| 902 SHOW_OFFLINE_ON_DISCONNECTED_NETWORK); | 910 SHOW_OFFLINE_ON_DISCONNECTED_NETWORK); |
| 903 ExpectOpenFileErrorCode(net::ERR_FILE_NOT_FOUND); | 911 ExpectOpenFileErrorCode(net::ERR_FILE_NOT_FOUND); |
| 904 } | 912 } |
| 905 | 913 |
| 906 } // namespace offline_pages | 914 } // namespace offline_pages |
| OLD | NEW |