| 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/prerendering_offliner.h" | 5 #include "chrome/browser/android/offline_pages/prerendering_offliner.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 EXPECT_FALSE(loader()->IsIdle()); | 444 EXPECT_FALSE(loader()->IsIdle()); |
| 445 | 445 |
| 446 offliner()->SetApplicationStateForTesting( | 446 offliner()->SetApplicationStateForTesting( |
| 447 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); | 447 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); |
| 448 | 448 |
| 449 // Loading canceled on low-end device. | 449 // Loading canceled on low-end device. |
| 450 EXPECT_TRUE(loader()->IsIdle()); | 450 EXPECT_TRUE(loader()->IsIdle()); |
| 451 EXPECT_EQ(Offliner::RequestStatus::FOREGROUND_CANCELED, request_status()); | 451 EXPECT_EQ(Offliner::RequestStatus::FOREGROUND_CANCELED, request_status()); |
| 452 } | 452 } |
| 453 | 453 |
| 454 TEST_F(PrerenderingOfflinerTest, ForegroundTransitionIgnoredOnHighEndDevice) { | 454 // TODO(crbug.com/712941): Flaky test. |
| 455 TEST_F(PrerenderingOfflinerTest, |
| 456 DISABLED_ForegroundTransitionIgnoredOnHighEndDevice) { |
| 455 offliner()->SetLowEndDeviceForTesting(false); | 457 offliner()->SetLowEndDeviceForTesting(false); |
| 456 | 458 |
| 457 base::Time creation_time = base::Time::Now(); | 459 base::Time creation_time = base::Time::Now(); |
| 458 SavePageRequest request( | 460 SavePageRequest request( |
| 459 kRequestId, kHttpUrl, kClientId, creation_time, kUserRequested); | 461 kRequestId, kHttpUrl, kClientId, creation_time, kUserRequested); |
| 460 EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), | 462 EXPECT_TRUE(offliner()->LoadAndSave(request, completion_callback(), |
| 461 progress_callback())); | 463 progress_callback())); |
| 462 EXPECT_FALSE(loader()->IsIdle()); | 464 EXPECT_FALSE(loader()->IsIdle()); |
| 463 | 465 |
| 464 offliner()->SetApplicationStateForTesting( | 466 offliner()->SetApplicationStateForTesting( |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 PumpLoop(); | 608 PumpLoop(); |
| 607 EXPECT_EQ(Offliner::RequestStatus::SAVED, request_status()); | 609 EXPECT_EQ(Offliner::RequestStatus::SAVED, request_status()); |
| 608 | 610 |
| 609 // One extra part should be added if the flag is on. | 611 // One extra part should be added if the flag is on. |
| 610 content::MHTMLExtraParts* extra_parts = | 612 content::MHTMLExtraParts* extra_parts = |
| 611 content::MHTMLExtraParts::FromWebContents(loader()->web_contents()); | 613 content::MHTMLExtraParts::FromWebContents(loader()->web_contents()); |
| 612 EXPECT_EQ(extra_parts->size(), 1); | 614 EXPECT_EQ(extra_parts->size(), 1); |
| 613 } | 615 } |
| 614 | 616 |
| 615 } // namespace offline_pages | 617 } // namespace offline_pages |
| OLD | NEW |