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 "components/offline_pages/background/request_coordinator.h" | 5 #include "components/offline_pages/background/request_coordinator.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "components/offline_pages/background/offliner_factory.h" | 11 #include "components/offline_pages/background/offliner_factory.h" |
12 #include "components/offline_pages/background/offliner_policy.h" | 12 #include "components/offline_pages/background/offliner_policy.h" |
13 #include "components/offline_pages/background/save_page_request.h" | 13 #include "components/offline_pages/background/save_page_request.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace offline_pages { | 16 namespace offline_pages { |
17 | 17 |
18 namespace { | 18 namespace { |
19 // put test constants here | 19 // put test constants here |
20 const int64_t kRequestId = 42; | |
21 const GURL kUrl("http://universe.com/everything"); | 20 const GURL kUrl("http://universe.com/everything"); |
22 const ClientId kClientId("bookmark", "1234"); | 21 const ClientId kClientId("bookmark", "42"); |
23 } // namespace | 22 } // namespace |
24 | 23 |
25 class RequestCoordinatorTest | 24 class RequestCoordinatorTest |
26 : public testing::Test { | 25 : public testing::Test { |
27 public: | 26 public: |
28 RequestCoordinatorTest(); | 27 RequestCoordinatorTest(); |
29 ~RequestCoordinatorTest() override; | 28 ~RequestCoordinatorTest() override; |
30 | 29 |
31 void CallbackFunction() { | 30 void CallbackFunction() { |
32 } | 31 } |
(...skipping 11 matching lines...) Expand all Loading... |
44 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); | 43 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); |
45 std::unique_ptr<OfflinerFactory> factory; | 44 std::unique_ptr<OfflinerFactory> factory; |
46 RequestCoordinator coordinator(std::move(policy), std::move(factory)); | 45 RequestCoordinator coordinator(std::move(policy), std::move(factory)); |
47 EXPECT_FALSE(coordinator.StartProcessing(callback)); | 46 EXPECT_FALSE(coordinator.StartProcessing(callback)); |
48 } | 47 } |
49 | 48 |
50 TEST_F(RequestCoordinatorTest, SavePageLater) { | 49 TEST_F(RequestCoordinatorTest, SavePageLater) { |
51 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); | 50 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); |
52 std::unique_ptr<OfflinerFactory> factory; | 51 std::unique_ptr<OfflinerFactory> factory; |
53 RequestCoordinator coordinator(std::move(policy), std::move(factory)); | 52 RequestCoordinator coordinator(std::move(policy), std::move(factory)); |
54 SavePageRequest request(kRequestId, kUrl, kClientId, base::Time::Now()); | 53 EXPECT_TRUE(coordinator.SavePageLater(kUrl, kClientId)); |
55 EXPECT_TRUE(coordinator.SavePageLater(request)); | |
56 } | 54 } |
57 | 55 |
58 } // namespace offline_pages | 56 } // namespace offline_pages |
OLD | NEW |