Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/offline_pages/background/request_coordinator.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "base/memory/weak_ptr.h" | |
|
fgorski
2016/05/04 18:20:16
nit: not needed
| |
| 9 #include "components/offline_pages/background/save_page_request.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | |
| 11 | |
| 12 namespace offline_pages { | |
| 13 | |
| 14 namespace { | |
| 15 // put test constants here | |
| 16 const int64_t kRequestId = 42; | |
| 17 const GURL kUrl("http://universe.com/everything"); | |
| 18 const ClientId kClientId("bookmark", "1234"); | |
| 19 } // namespace | |
| 20 | |
| 21 class RequestCoordinatorTest | |
| 22 : public testing::Test { | |
| 23 public: | |
| 24 RequestCoordinatorTest(); | |
| 25 ~RequestCoordinatorTest() override; | |
| 26 | |
| 27 void CallbackFunction() { | |
| 28 } | |
| 29 }; | |
| 30 | |
| 31 RequestCoordinatorTest::RequestCoordinatorTest() {} | |
| 32 | |
| 33 RequestCoordinatorTest::~RequestCoordinatorTest() {} | |
| 34 | |
| 35 TEST_F(RequestCoordinatorTest, StartProcessingWithNoRequests) { | |
| 36 RequestCoordinator::ProcessingDoneCallback callback = | |
| 37 base::Bind( | |
| 38 &RequestCoordinatorTest::CallbackFunction, | |
| 39 base::Unretained(this)); | |
| 40 RequestCoordinator coordinator; | |
| 41 EXPECT_FALSE(coordinator.StartProcessing(callback)); | |
| 42 } | |
| 43 | |
| 44 TEST_F(RequestCoordinatorTest, SavePageLater) { | |
| 45 RequestCoordinator coordinator; | |
| 46 SavePageRequest request(kRequestId, kUrl, kClientId, base::Time::Now()); | |
| 47 EXPECT_TRUE(coordinator.SavePageLater(request)); | |
| 48 } | |
| 49 | |
| 50 } // namespace offline_pages | |
| OLD | NEW |