OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ |
| 6 #define CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/media/router/media_route.h" |
| 12 #include "chrome/browser/media/router/media_router.h" |
| 13 #include "chrome/test/media_router/media_router_base_browsertest.h" |
| 14 #include "chrome/test/media_router/test_media_sinks_observer.h" |
| 15 |
| 16 |
| 17 namespace media_router { |
| 18 |
| 19 class MediaRouter; |
| 20 |
| 21 class MediaRouterE2EBrowserTest : public MediaRouterBaseBrowserTest { |
| 22 public: |
| 23 MediaRouterE2EBrowserTest(); |
| 24 ~MediaRouterE2EBrowserTest() override; |
| 25 |
| 26 protected: |
| 27 // InProcessBrowserTest Overrides |
| 28 void SetUpOnMainThread() override; |
| 29 void TearDownOnMainThread() override; |
| 30 |
| 31 // MediaRouterBaseBrowserTest Overrides |
| 32 void ParseCommandLine() override; |
| 33 |
| 34 // Callback from MediaRouter when a response to a media route request is |
| 35 // received. |
| 36 void OnRouteResponseReceived(scoped_ptr<MediaRoute> route, |
| 37 const std::string& error); |
| 38 |
| 39 // Initializes |observer_| to listen for sinks compatible with |source|, |
| 40 // finds sink with name matching receiver_, and establishes media |
| 41 // route between the source and sink. |
| 42 // |observer_| and |route_id_| will be initialized. |
| 43 void CreateMediaRoute(const MediaSource& source); |
| 44 |
| 45 // Stops the established media route and unregisters |observer_|. |
| 46 // Note that the route may not be stopped immediately, as it makes an |
| 47 // async call to the Media Route Provider. |
| 48 // |observer_| and |route_id_| will be reset. |
| 49 void StopMediaRoute(); |
| 50 |
| 51 std::string receiver() const { return receiver_; } |
| 52 |
| 53 bool IsDeviceDiscoveried() const; |
| 54 bool IsRouteCreated() const; |
| 55 |
| 56 private: |
| 57 std::string receiver_; |
| 58 |
| 59 MediaRouter* media_router_; |
| 60 scoped_ptr<TestMediaSinksObserver> observer_; |
| 61 MediaRoute::Id route_id_; |
| 62 }; |
| 63 |
| 64 } // namespace media_router |
| 65 |
| 66 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ |
OLD | NEW |