Update V8 to version 4.6.22.
[chromium-blink-merge.git] / chrome / test / media_router / media_router_e2e_browsertest.h
blob385fd30b9bcfadcd2ab7665f02978a385f38b8b8
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.
5 #ifndef CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_
6 #define CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_
8 #include <string>
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"
16 namespace media_router {
18 class MediaRouter;
20 class MediaRouterE2EBrowserTest : public MediaRouterBaseBrowserTest {
21 public:
22 MediaRouterE2EBrowserTest();
23 ~MediaRouterE2EBrowserTest() override;
25 protected:
26 // InProcessBrowserTest Overrides
27 void SetUpOnMainThread() override;
28 void TearDownOnMainThread() override;
30 // MediaRouterBaseBrowserTest Overrides
31 void ParseCommandLine() override;
33 // Callback from MediaRouter when a response to a media route request is
34 // received.
35 void OnRouteResponseReceived(const MediaRoute* route,
36 const std::string& error);
38 // Initializes |observer_| to listen for sinks compatible with |source|,
39 // finds sink with name matching receiver_, and establishes media
40 // route between the source and sink.
41 // |observer_| and |route_id_| will be initialized.
42 // |origin| is the URL of requestor's page.
43 // |tab_id| is the ID of the tab in which the request was made.
44 // |origin| and |tab_id| are used for enforcing same-origin and/or same-tab
45 // scope for JoinRoute() requests. (e.g., if enforced, the page
46 // requesting JoinRoute() must have the same origin as the page that requested
47 // CreateRoute()).
48 void CreateMediaRoute(const MediaSource& source,
49 const GURL& origin,
50 int tab_id);
52 // Stops the established media route and unregisters |observer_|.
53 // Note that the route may not be stopped immediately, as it makes an
54 // async call to the Media Route Provider.
55 // |observer_| and |route_id_| will be reset.
56 void StopMediaRoute();
58 std::string receiver() const { return receiver_; }
60 bool IsSinkDiscovered() const;
61 bool IsRouteCreated() const;
63 private:
64 std::string receiver_;
66 MediaRouter* media_router_;
67 scoped_ptr<TestMediaSinksObserver> observer_;
68 MediaRoute::Id route_id_;
71 } // namespace media_router
73 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_