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

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

Issue 2342803003: [Offline Pages] Gates immediate triggering (non scheduled) of background (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 633f47968f42a32b3a3d5b30fcad6b894c838047..80e820282fe92c7ca366a67442f1e6aa71ac6e4a 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"
@@ -882,12 +883,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) {
@@ -898,7 +907,8 @@ TEST_F(RequestCoordinatorTest, SavePageDoesntStartProcessingWhenDisconnected) {
EXPECT_FALSE(is_busy());
}
-TEST_F(RequestCoordinatorTest, ResumeStartsProcessingWhenConnected) {
+TEST_F(RequestCoordinatorTest,
+ ResumeStartsProcessingWhenConnectedAndNotLowEndDevice) {
SetNetworkConditionsForTest(
net::NetworkChangeNotifier::ConnectionType::CONNECTION_NONE);
@@ -934,7 +944,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