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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "content/public/test/test_utils.h" | 6 #include "content/public/test/test_utils.h" |
7 #include "extensions/browser/api/display_source/display_source_connection_delega
te.h" | 7 #include "extensions/browser/api/display_source/display_source_connection_delega
te.h" |
8 #include "extensions/browser/api/display_source/display_source_connection_delega
te_factory.h" | 8 #include "extensions/browser/api/display_source/display_source_connection_delega
te_factory.h" |
9 #include "extensions/shell/test/shell_apitest.h" | 9 #include "extensions/shell/test/shell_apitest.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 class MockDisplaySourceConnectionDelegate | 33 class MockDisplaySourceConnectionDelegate |
34 : public DisplaySourceConnectionDelegate { | 34 : public DisplaySourceConnectionDelegate { |
35 public: | 35 public: |
36 DisplaySourceSinkInfoList last_found_sinks() const override { return sinks_; } | 36 DisplaySourceSinkInfoList last_found_sinks() const override { return sinks_; } |
37 const Connection* connection() const override { return nullptr; } | 37 const Connection* connection() const override { return nullptr; } |
38 void GetAvailableSinks(const SinkInfoListCallback& sinks_callback, | 38 void GetAvailableSinks(const SinkInfoListCallback& sinks_callback, |
39 const FailureCallback& failure_callback) override { | 39 const StringCallback& failure_callback) override { |
40 AddSink(CreateSinkInfoPtr(1, "sink 1", SINK_STATE_DISCONNECTED)); | 40 AddSink(CreateSinkInfoPtr(1, "sink 1", SINK_STATE_DISCONNECTED)); |
41 sinks_callback.Run(sinks_); | 41 sinks_callback.Run(sinks_); |
42 } | 42 } |
43 | 43 |
44 void RequestAuthentication(int sink_id, | 44 void RequestAuthentication(int sink_id, |
45 const AuthInfoCallback& auth_info_callback, | 45 const AuthInfoCallback& auth_info_callback, |
46 const FailureCallback& failure_callback) override { | 46 const StringCallback& failure_callback) override { |
47 DisplaySourceAuthInfo info; | 47 DisplaySourceAuthInfo info; |
48 info.method = AUTHENTICATION_METHOD_PBC; | 48 info.method = AUTHENTICATION_METHOD_PBC; |
49 auth_info_callback.Run(info); | 49 auth_info_callback.Run(info); |
50 } | 50 } |
51 | 51 |
52 void Connect(int sink_id, | 52 void Connect(int sink_id, |
53 const DisplaySourceAuthInfo& auth_info, | 53 const DisplaySourceAuthInfo& auth_info, |
54 const FailureCallback& failure_callback) override {} | 54 const StringCallback& failure_callback) override {} |
55 | 55 |
56 void Disconnect(const FailureCallback& failure_callback) override {} | 56 void Disconnect(const StringCallback& failure_callback) override {} |
57 | 57 |
58 void StartWatchingAvailableSinks() override { | 58 void StartWatchingAvailableSinks() override { |
59 AddSink(CreateSinkInfoPtr(2, "sink 2", SINK_STATE_DISCONNECTED)); | 59 AddSink(CreateSinkInfoPtr(2, "sink 2", SINK_STATE_DISCONNECTED)); |
60 } | 60 } |
61 | 61 |
62 void StopWatchingAvailableSinks() override {} | 62 void StopWatchingAvailableSinks() override {} |
63 | 63 |
64 private: | 64 private: |
65 void AddSink(DisplaySourceSinkInfoPtr sink) { | 65 void AddSink(DisplaySourceSinkInfoPtr sink) { |
66 sinks_.push_back(sink); | 66 sinks_.push_back(sink); |
(...skipping 21 matching lines...) Expand all Loading... |
88 browser_context(), &CreateMockDelegate); | 88 browser_context(), &CreateMockDelegate); |
89 content::RunAllPendingInMessageLoop(); | 89 content::RunAllPendingInMessageLoop(); |
90 } | 90 } |
91 }; | 91 }; |
92 | 92 |
93 IN_PROC_BROWSER_TEST_F(DisplaySourceApiTest, DisplaySourceExtension) { | 93 IN_PROC_BROWSER_TEST_F(DisplaySourceApiTest, DisplaySourceExtension) { |
94 ASSERT_TRUE(RunAppTest("api_test/display_source/api")) << message_; | 94 ASSERT_TRUE(RunAppTest("api_test/display_source/api")) << message_; |
95 } | 95 } |
96 | 96 |
97 } // namespace extensions | 97 } // namespace extensions |
OLD | NEW |