| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 | 46 |
| 47 class TimeProviderMock : public PrinterJobQueueHandler::TimeProvider { | 47 class TimeProviderMock : public PrinterJobQueueHandler::TimeProvider { |
| 48 public: | 48 public: |
| 49 MOCK_METHOD0(GetNow, base::Time()); | 49 MOCK_METHOD0(GetNow, base::Time()); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 class PrinterJobQueueHandlerTest : public ::testing::Test { | 52 class PrinterJobQueueHandlerTest : public ::testing::Test { |
| 53 protected: | 53 protected: |
| 54 base::Value* data_; | 54 base::Value* data_; |
| 55 base::DictionaryValue* json_data_; | 55 base::DictionaryValue* json_data_; |
| 56 virtual void SetUp() { | 56 void SetUp() override { |
| 57 base::JSONReader json_reader; | 57 base::JSONReader json_reader; |
| 58 data_ = json_reader.Read(kJobListResponse); | 58 data_ = json_reader.Read(kJobListResponse); |
| 59 data_->GetAsDictionary(&json_data_); | 59 data_->GetAsDictionary(&json_data_); |
| 60 } | 60 } |
| 61 | 61 |
| 62 virtual void TearDown() { | 62 void TearDown() override { delete data_; } |
| 63 delete data_; | |
| 64 } | |
| 65 }; | 63 }; |
| 66 | 64 |
| 67 TEST_F(PrinterJobQueueHandlerTest, BasicJobReadTest) { | 65 TEST_F(PrinterJobQueueHandlerTest, BasicJobReadTest) { |
| 68 PrinterJobQueueHandler job_queue_handler; | 66 PrinterJobQueueHandler job_queue_handler; |
| 69 std::vector<JobDetails> jobs; | 67 std::vector<JobDetails> jobs; |
| 70 | 68 |
| 71 job_queue_handler.GetJobsFromQueue(json_data_, &jobs); | 69 job_queue_handler.GetJobsFromQueue(json_data_, &jobs); |
| 72 | 70 |
| 73 ASSERT_EQ((size_t)3, jobs.size()); | 71 ASSERT_EQ((size_t)3, jobs.size()); |
| 74 | 72 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 base::TimeDelta::FromSeconds(4) + time_to_wait)); | 170 base::TimeDelta::FromSeconds(4) + time_to_wait)); |
| 173 | 171 |
| 174 job_queue_handler.GetJobsFromQueue(json_data_, | 172 job_queue_handler.GetJobsFromQueue(json_data_, |
| 175 &jobs); | 173 &jobs); |
| 176 | 174 |
| 177 EXPECT_EQ(base::TimeDelta(), jobs[0].time_remaining_); | 175 EXPECT_EQ(base::TimeDelta(), jobs[0].time_remaining_); |
| 178 EXPECT_EQ(std::string("__testjob2"), jobs[0].job_id_); | 176 EXPECT_EQ(std::string("__testjob2"), jobs[0].job_id_); |
| 179 } | 177 } |
| 180 | 178 |
| 181 } // namespace cloud_print | 179 } // namespace cloud_print |
| OLD | NEW |