| 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 ebcbe140f39a7b3f1a30b8ffbf8e619d52ed20f4..cda7460f99c70a5fcce754f9203025beed355085 100644
|
| --- a/components/offline_pages/background/request_coordinator_unittest.cc
|
| +++ b/components/offline_pages/background/request_coordinator_unittest.cc
|
| @@ -10,6 +10,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/location.h"
|
| +#include "base/logging.h"
|
| #include "base/test/test_simple_task_runner.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "components/offline_pages/background/device_conditions.h"
|
| @@ -92,6 +93,14 @@ class RequestCoordinatorTest
|
| return coordinator_.get();
|
| }
|
|
|
| + bool request_in_progress() {
|
| + return coordinator_->is_busy();
|
| + }
|
| +
|
| + void SendRequestToOffliner(SavePageRequest& request) {
|
| + coordinator_->SendRequestToOffliner(request);
|
| + }
|
| +
|
| // Empty callback function
|
| void EmptyCallbackFunction(bool result) {
|
| }
|
| @@ -175,6 +184,23 @@ TEST_F(RequestCoordinatorTest, StartProcessingWithNoRequests) {
|
| EXPECT_TRUE(coordinator()->StartProcessing(device_conditions, callback));
|
| }
|
|
|
| +TEST_F(RequestCoordinatorTest, StartProcessingWithRequestInProgress) {
|
| + // Build a request.
|
| + offline_pages::SavePageRequest request(
|
| + kRequestId, kUrl, kClientId, base::Time::Now());
|
| + // Sending the request to the offliner should make it busy.
|
| + SendRequestToOffliner(request);
|
| + EXPECT_TRUE(request_in_progress());
|
| + // Now trying to start processing on another request should return false.
|
| + DeviceConditions device_conditions(false, 75,
|
| + net::NetworkChangeNotifier::CONNECTION_3G);
|
| + base::Callback<void(bool)> callback =
|
| + base::Bind(
|
| + &RequestCoordinatorTest::EmptyCallbackFunction,
|
| + base::Unretained(this));
|
| + EXPECT_FALSE(coordinator()->StartProcessing(device_conditions, callback));
|
| +}
|
| +
|
| TEST_F(RequestCoordinatorTest, SavePageLater) {
|
| EXPECT_TRUE(coordinator()->SavePageLater(kUrl, kClientId));
|
|
|
|
|