OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "extensions/browser/api/media_perception_private/media_perception_api_m
anager.h" | 5 #include "extensions/browser/api/media_perception_private/media_perception_api_m
anager.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "chromeos/dbus/dbus_thread_manager.h" | 12 #include "chromeos/dbus/dbus_thread_manager.h" |
13 #include "chromeos/dbus/fake_media_analytics_client.h" | 13 #include "chromeos/dbus/fake_media_analytics_client.h" |
14 #include "chromeos/dbus/fake_upstart_client.h" | 14 #include "chromeos/dbus/fake_upstart_client.h" |
15 #include "chromeos/dbus/media_analytics_client.h" | 15 #include "chromeos/dbus/media_analytics_client.h" |
16 #include "chromeos/dbus/upstart_client.h" | 16 #include "chromeos/dbus/upstart_client.h" |
17 #include "content/public/test/test_browser_context.h" | 17 #include "content/public/test/test_browser_context.h" |
18 #include "content/public/test/test_browser_thread_bundle.h" | 18 #include "content/public/test/test_browser_thread_bundle.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 namespace media_perception = extensions::api::media_perception_private; | 21 namespace media_perception = extensions::api::media_perception_private; |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 namespace { | 24 namespace { |
25 | 25 |
26 class TestUpstartClient : public FakeUpstartClient { | 26 class TestUpstartClient : public FakeUpstartClient { |
27 public: | 27 public: |
28 TestUpstartClient() : enqueue_requests_(false) {} | 28 TestUpstartClient() : enqueue_requests_(false) {} |
29 | 29 |
30 ~TestUpstartClient() override{}; | 30 ~TestUpstartClient() override {} |
31 | 31 |
32 // Overrides behavior to queue start requests. | 32 // Overrides behavior to queue start requests. |
33 void StartMediaAnalytics(const UpstartCallback& callback) override { | 33 void StartMediaAnalytics(const UpstartCallback& callback) override { |
34 pending_upstart_request_callbacks_.push(callback); | 34 pending_upstart_request_callbacks_.push(callback); |
35 if (!enqueue_requests_) { | 35 if (!enqueue_requests_) { |
36 HandleNextUpstartRequest(true); | 36 HandleNextUpstartRequest(true); |
37 return; | 37 return; |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 SetStateAndWaitForResponse(manager_.get(), state)); | 199 SetStateAndWaitForResponse(manager_.get(), state)); |
200 // Disable the functionality of the fake process. | 200 // Disable the functionality of the fake process. |
201 media_analytics_client_->set_process_running(false); | 201 media_analytics_client_->set_process_running(false); |
202 EXPECT_EQ(CallbackStatus::DBUS_ERROR, | 202 EXPECT_EQ(CallbackStatus::DBUS_ERROR, |
203 GetStateAndWaitForResponse(manager_.get())); | 203 GetStateAndWaitForResponse(manager_.get())); |
204 EXPECT_EQ(CallbackStatus::DBUS_ERROR, | 204 EXPECT_EQ(CallbackStatus::DBUS_ERROR, |
205 SetStateAndWaitForResponse(manager_.get(), state)); | 205 SetStateAndWaitForResponse(manager_.get(), state)); |
206 } | 206 } |
207 | 207 |
208 } // namespace extensions | 208 } // namespace extensions |
OLD | NEW |