OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/chromeos/extensions/file_manager/job_event_router.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/job_event_router.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
7 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
10 | 14 |
11 namespace file_manager { | 15 namespace file_manager { |
12 namespace { | 16 namespace { |
13 | 17 |
14 class JobEventRouterImpl : public JobEventRouter { | 18 class JobEventRouterImpl : public JobEventRouter { |
15 public: | 19 public: |
16 JobEventRouterImpl() : JobEventRouter(base::TimeDelta::FromMilliseconds(0)) { | 20 JobEventRouterImpl() : JobEventRouter(base::TimeDelta::FromMilliseconds(0)) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 std::set<std::string> listener_extension_ids_; | 56 std::set<std::string> listener_extension_ids_; |
53 | 57 |
54 DISALLOW_COPY_AND_ASSIGN(JobEventRouterImpl); | 58 DISALLOW_COPY_AND_ASSIGN(JobEventRouterImpl); |
55 }; | 59 }; |
56 | 60 |
57 class JobEventRouterTest : public testing::Test { | 61 class JobEventRouterTest : public testing::Test { |
58 protected: | 62 protected: |
59 void SetUp() override { job_event_router.reset(new JobEventRouterImpl()); } | 63 void SetUp() override { job_event_router.reset(new JobEventRouterImpl()); } |
60 | 64 |
61 drive::JobInfo CreateJobInfo(drive::JobID id, | 65 drive::JobInfo CreateJobInfo(drive::JobID id, |
62 int64 num_completed_bytes, | 66 int64_t num_completed_bytes, |
63 int64 num_total_bytes, | 67 int64_t num_total_bytes, |
64 const base::FilePath& file_path) { | 68 const base::FilePath& file_path) { |
65 drive::JobInfo job(drive::TYPE_DOWNLOAD_FILE); | 69 drive::JobInfo job(drive::TYPE_DOWNLOAD_FILE); |
66 job.job_id = id; | 70 job.job_id = id; |
67 job.num_total_bytes = num_total_bytes; | 71 job.num_total_bytes = num_total_bytes; |
68 job.num_completed_bytes = num_completed_bytes; | 72 job.num_completed_bytes = num_completed_bytes; |
69 job.file_path = file_path; | 73 job.file_path = file_path; |
70 return job; | 74 return job; |
71 } | 75 } |
72 | 76 |
73 std::string GetEventString(size_t index, const std::string& name) { | 77 std::string GetEventString(size_t index, const std::string& name) { |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // Check event for extension_b. | 240 // Check event for extension_b. |
237 EXPECT_EQ("in_progress", GetEventString(1, "transferState")); | 241 EXPECT_EQ("in_progress", GetEventString(1, "transferState")); |
238 EXPECT_EQ(0.0f, GetEventDouble(1, "processed")); | 242 EXPECT_EQ(0.0f, GetEventDouble(1, "processed")); |
239 EXPECT_EQ(100.0f, GetEventDouble(1, "total")); | 243 EXPECT_EQ(100.0f, GetEventDouble(1, "total")); |
240 EXPECT_EQ("filesystem:chrome-extension://extension_b/test/a", | 244 EXPECT_EQ("filesystem:chrome-extension://extension_b/test/a", |
241 GetEventString(1, "fileUrl")); | 245 GetEventString(1, "fileUrl")); |
242 } | 246 } |
243 | 247 |
244 } // namespace | 248 } // namespace |
245 } // namespace file_manager | 249 } // namespace file_manager |
OLD | NEW |