OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/service/cloud_print/printer_job_queue_handler.h" | 5 #include "chrome/service/cloud_print/printer_job_queue_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 "]" | 46 "]" |
47 "}"; | 47 "}"; |
48 | 48 |
49 class TimeProviderMock : public PrinterJobQueueHandler::TimeProvider { | 49 class TimeProviderMock : public PrinterJobQueueHandler::TimeProvider { |
50 public: | 50 public: |
51 MOCK_METHOD0(GetNow, base::Time()); | 51 MOCK_METHOD0(GetNow, base::Time()); |
52 }; | 52 }; |
53 | 53 |
54 class PrinterJobQueueHandlerTest : public ::testing::Test { | 54 class PrinterJobQueueHandlerTest : public ::testing::Test { |
55 protected: | 55 protected: |
56 scoped_ptr<base::Value> data_; | 56 std::unique_ptr<base::Value> data_; |
57 | 57 |
58 const base::DictionaryValue* GetAsDictionary() const { | 58 const base::DictionaryValue* GetAsDictionary() const { |
59 const base::DictionaryValue* json_data_ = nullptr; | 59 const base::DictionaryValue* json_data_ = nullptr; |
60 EXPECT_TRUE(data_->GetAsDictionary(&json_data_)); | 60 EXPECT_TRUE(data_->GetAsDictionary(&json_data_)); |
61 return json_data_; | 61 return json_data_; |
62 } | 62 } |
63 | 63 |
64 void SetUp() override { | 64 void SetUp() override { |
65 base::JSONReader json_reader; | 65 base::JSONReader json_reader; |
66 data_ = json_reader.Read(kJobListResponse); | 66 data_ = json_reader.Read(kJobListResponse); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 .WillByDefault(Return(base::Time::UnixEpoch() + | 173 .WillByDefault(Return(base::Time::UnixEpoch() + |
174 base::TimeDelta::FromSeconds(4) + time_to_wait)); | 174 base::TimeDelta::FromSeconds(4) + time_to_wait)); |
175 | 175 |
176 job_queue_handler.GetJobsFromQueue(GetAsDictionary(), &jobs); | 176 job_queue_handler.GetJobsFromQueue(GetAsDictionary(), &jobs); |
177 | 177 |
178 EXPECT_EQ(base::TimeDelta(), jobs[0].time_remaining_); | 178 EXPECT_EQ(base::TimeDelta(), jobs[0].time_remaining_); |
179 EXPECT_EQ(std::string("__testjob2"), jobs[0].job_id_); | 179 EXPECT_EQ(std::string("__testjob2"), jobs[0].job_id_); |
180 } | 180 } |
181 | 181 |
182 } // namespace cloud_print | 182 } // namespace cloud_print |
OLD | NEW |