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

Unified Diff: components/offline_pages/background/request_coordinator_unittest.cc

Issue 2338313002: [Offline Pages] Gates immediate triggering (non scheduled) of background loading by whether low end… (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/offline_pages/background/request_coordinator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/background/request_coordinator_unittest.cc
diff --git a/components/offline_pages/background/request_coordinator_unittest.cc b/components/offline_pages/background/request_coordinator_unittest.cc
index f3a32b36ae18523e4324b4a331d58bd75a518394..1b469fd84cd2091b005807a1138a77aa2db82128 100644
--- a/components/offline_pages/background/request_coordinator_unittest.cc
+++ b/components/offline_pages/background/request_coordinator_unittest.cc
@@ -12,6 +12,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/synchronization/waitable_event.h"
+#include "base/sys_info.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
@@ -959,12 +960,20 @@ TEST_F(RequestCoordinatorTest, RemoveRequest) {
EXPECT_EQ(kRequestId1, std::get<0>(last_remove_results().at(0)));
}
-TEST_F(RequestCoordinatorTest, SavePageStartsProcessingWhenConnected) {
+TEST_F(RequestCoordinatorTest,
+ SavePageStartsProcessingWhenConnectedAndNotLowEndDevice) {
SetNetworkConditionsForTest(
net::NetworkChangeNotifier::ConnectionType::CONNECTION_3G);
EXPECT_TRUE(coordinator()->SavePageLater(kUrl1, kClientId1, kUserRequested));
PumpLoop();
- EXPECT_TRUE(is_busy());
+
+ // Now whether processing triggered immediately depends on whether test
+ // is run on svelte device or not.
+ if (base::SysInfo::IsLowEndDevice()) {
+ EXPECT_FALSE(is_busy());
+ } else {
+ EXPECT_TRUE(is_busy());
+ }
}
TEST_F(RequestCoordinatorTest, SavePageDoesntStartProcessingWhenDisconnected) {
@@ -975,7 +984,8 @@ TEST_F(RequestCoordinatorTest, SavePageDoesntStartProcessingWhenDisconnected) {
EXPECT_FALSE(is_busy());
}
-TEST_F(RequestCoordinatorTest, ResumeStartsProcessingWhenConnected) {
+TEST_F(RequestCoordinatorTest,
+ ResumeStartsProcessingWhenConnectedAndNotLowEndDevice) {
SetNetworkConditionsForTest(
net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE);
@@ -1011,7 +1021,14 @@ TEST_F(RequestCoordinatorTest, ResumeStartsProcessingWhenConnected) {
coordinator()->ResumeRequests(request_ids);
EXPECT_FALSE(is_busy());
PumpLoop();
- EXPECT_TRUE(is_busy());
+
+ // Now whether processing triggered immediately depends on whether test
+ // is run on svelte device or not.
+ if (base::SysInfo::IsLowEndDevice()) {
+ EXPECT_FALSE(is_busy());
+ } else {
+ EXPECT_TRUE(is_busy());
+ }
}
} // namespace offline_pages
« no previous file with comments | « components/offline_pages/background/request_coordinator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698