| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/leak_annotations.h" | 8 #include "base/debug/leak_annotations.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } tests[] = { | 497 } tests[] = { |
| 498 // With no previews enabled for the frame, no previews should be | 498 // With no previews enabled for the frame, no previews should be |
| 499 // activated. | 499 // activated. |
| 500 {PREVIEWS_UNSPECIFIED, false, WebURLRequest::kPreviewsUnspecified, false}, | 500 {PREVIEWS_UNSPECIFIED, false, WebURLRequest::kPreviewsUnspecified, false}, |
| 501 | 501 |
| 502 // If the request already has a previews state set, then Client Lo-Fi | 502 // If the request already has a previews state set, then Client Lo-Fi |
| 503 // should only be used if the request already has that bit set. | 503 // should only be used if the request already has that bit set. |
| 504 {CLIENT_LOFI_ON, false, WebURLRequest::kServerLoFiOn, false}, | 504 {CLIENT_LOFI_ON, false, WebURLRequest::kServerLoFiOn, false}, |
| 505 {PREVIEWS_UNSPECIFIED, false, WebURLRequest::kClientLoFiOn, true}, | 505 {PREVIEWS_UNSPECIFIED, false, WebURLRequest::kClientLoFiOn, true}, |
| 506 {CLIENT_LOFI_ON, false, WebURLRequest::kClientLoFiOn, true}, | 506 {CLIENT_LOFI_ON, false, WebURLRequest::kClientLoFiOn, true}, |
| 507 {CLIENT_LOFI_ON | SERVER_LITE_PAGE_ON, true, |
| 508 WebURLRequest::kPreviewsUnspecified, true}, |
| 509 {CLIENT_LOFI_ON | SERVER_LITE_PAGE_ON, false, |
| 510 WebURLRequest::kPreviewsUnspecified, true}, |
| 507 | 511 |
| 508 // If Client Lo-Fi isn't enabled for the frame, then it shouldn't be used | 512 // If Client Lo-Fi isn't enabled for the frame, then it shouldn't be used |
| 509 // for any requests. | 513 // for any requests. |
| 510 {SERVER_LOFI_ON, true, WebURLRequest::kPreviewsUnspecified, false}, | 514 {SERVER_LOFI_ON, true, WebURLRequest::kPreviewsUnspecified, false}, |
| 511 | 515 |
| 512 // SERVER_LITE_PAGE_ON, PREVIEWS_NO_TRANSFORM, and PREVIEWS_OFF should | 516 // PREVIEWS_NO_TRANSFORM and PREVIEWS_OFF should take precedence |
| 513 // take precedence over Client Lo-Fi. | 517 // over Client Lo-Fi. |
| 514 {CLIENT_LOFI_ON | SERVER_LITE_PAGE_ON, false, | |
| 515 WebURLRequest::kPreviewsUnspecified, false}, | |
| 516 {CLIENT_LOFI_ON | SERVER_LITE_PAGE_ON, true, | |
| 517 WebURLRequest::kPreviewsUnspecified, false}, | |
| 518 {CLIENT_LOFI_ON | PREVIEWS_NO_TRANSFORM, false, | 518 {CLIENT_LOFI_ON | PREVIEWS_NO_TRANSFORM, false, |
| 519 WebURLRequest::kPreviewsUnspecified, false}, | 519 WebURLRequest::kPreviewsUnspecified, false}, |
| 520 {CLIENT_LOFI_ON | PREVIEWS_OFF, false, | 520 {CLIENT_LOFI_ON | PREVIEWS_OFF, false, |
| 521 WebURLRequest::kPreviewsUnspecified, false}, | 521 WebURLRequest::kPreviewsUnspecified, false}, |
| 522 | 522 |
| 523 // If both Server Lo-Fi and Client Lo-Fi are enabled for the frame, then | 523 // If both Server Lo-Fi and Client Lo-Fi are enabled for the frame, then |
| 524 // only https:// requests should use Client Lo-Fi. | 524 // only https:// requests should use Client Lo-Fi. |
| 525 {CLIENT_LOFI_ON | SERVER_LOFI_ON, false, | 525 {CLIENT_LOFI_ON | SERVER_LOFI_ON, false, |
| 526 WebURLRequest::kPreviewsUnspecified, false}, | 526 WebURLRequest::kPreviewsUnspecified, false}, |
| 527 {CLIENT_LOFI_ON | SERVER_LOFI_ON, true, | 527 {CLIENT_LOFI_ON | SERVER_LOFI_ON, true, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 541 GURL(test.is_https ? "https://example.com" : "http://example.com")); | 541 GURL(test.is_https ? "https://example.com" : "http://example.com")); |
| 542 request.SetPreviewsState(test.initial_request_previews_state); | 542 request.SetPreviewsState(test.initial_request_previews_state); |
| 543 | 543 |
| 544 EXPECT_EQ(test.expected_should_use_client_lo_fi_for_request, | 544 EXPECT_EQ(test.expected_should_use_client_lo_fi_for_request, |
| 545 frame()->ShouldUseClientLoFiForRequest(request)) | 545 frame()->ShouldUseClientLoFiForRequest(request)) |
| 546 << (&test - tests); | 546 << (&test - tests); |
| 547 } | 547 } |
| 548 } | 548 } |
| 549 | 549 |
| 550 } // namespace content | 550 } // namespace content |
| OLD | NEW |