Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/test/media_router/media_router_one_ua_integration_browsertest.cc

Issue 2820433003: [Presentation API] Add browser tests for 1-UA mode (Closed)
Patch Set: fix android test failures Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 #include <memory>
5
6 #include "base/files/file_util.h"
7 #include "base/path_service.h"
8 #include "chrome/test/media_router/media_router_integration_browsertest.h"
9 #include "content/public/test/test_utils.h"
10 #include "net/base/filename_util.h"
11 #include "net/test/embedded_test_server/embedded_test_server.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 using content::WebContents;
15
16 namespace media_router {
17
18 namespace {
19 const char kInitiateCloseFromReceiverPageScript[] =
20 "initiateCloseFromReceiverPage();";
21 }
22
23 class MediaRouterOneUAIntegrationBrowserTest
24 : public MediaRouterIntegrationBrowserTest {
25 public:
26 void SetUpOnMainThread() override {
27 MediaRouterIntegrationBrowserTest::SetUpOnMainThread();
28
29 // Set up embedded test server to serve offscreen presentation with relative
30 // URL "presentation_receiver.html".
31 base::FilePath base_dir;
32 CHECK(PathService::Get(base::DIR_MODULE, &base_dir));
33 base::FilePath resource_dir = base_dir.Append(
34 FILE_PATH_LITERAL("media_router/browser_test_resources/"));
35 embedded_test_server()->ServeFilesFromDirectory(resource_dir);
36 ASSERT_TRUE(embedded_test_server()->Start());
37 }
38
39 GURL GetTestPageUrl(const base::FilePath& full_path) override {
40 GURL url = embedded_test_server()->GetURL("/basic_test.html");
41 return GURL(url.spec() + "?__oneUA__=true");
42 }
43 };
44
45 IN_PROC_BROWSER_TEST_F(MediaRouterOneUAIntegrationBrowserTest, MANUAL_Basic) {
46 RunBasicTest();
47 }
48
49 IN_PROC_BROWSER_TEST_F(MediaRouterOneUAIntegrationBrowserTest,
50 MANUAL_SendAndOnMessage) {
51 RunSendMessageTest("foo");
52 }
53
54 IN_PROC_BROWSER_TEST_F(MediaRouterOneUAIntegrationBrowserTest,
55 MANUAL_ReceiverCloseConnection) {
56 WebContents* web_contents = StartSessionWithTestPageAndChooseSink();
57 CheckSessionValidity(web_contents);
58 ExecuteJavaScriptAPI(web_contents, kInitiateCloseFromReceiverPageScript);
59 }
60
61 IN_PROC_BROWSER_TEST_F(MediaRouterOneUAIntegrationBrowserTest,
62 MANUAL_Fail_SendMessage) {
63 RunFailToSendMessageTest();
64 }
65
66 IN_PROC_BROWSER_TEST_F(MediaRouterOneUAIntegrationBrowserTest,
67 MANUAL_ReconnectSession) {
68 RunReconnectSessionTest();
69 }
70
71 IN_PROC_BROWSER_TEST_F(MediaRouterOneUAIntegrationBrowserTest,
72 MANUAL_ReconnectSessionSameTab) {
73 RunReconnectSessionSameTabTest();
74 }
75
76 class MediaRouterOneUANoReceiverIntegrationBrowserTest
77 : public MediaRouterIntegrationBrowserTest {
78 public:
79 GURL GetTestPageUrl(const base::FilePath& full_path) override {
80 GURL url = MediaRouterIntegrationBrowserTest::GetTestPageUrl(full_path);
81 return GURL(url.spec() + "?__oneUANoReceiver__=true");
82 }
83 };
84
85 IN_PROC_BROWSER_TEST_F(MediaRouterOneUANoReceiverIntegrationBrowserTest,
86 MANUAL_Basic) {
87 RunBasicTest();
88 }
89
90 IN_PROC_BROWSER_TEST_F(MediaRouterOneUANoReceiverIntegrationBrowserTest,
91 MANUAL_Fail_SendMessage) {
92 RunFailToSendMessageTest();
93 }
94
95 IN_PROC_BROWSER_TEST_F(MediaRouterOneUANoReceiverIntegrationBrowserTest,
96 MANUAL_ReconnectSession) {
97 RunReconnectSessionTest();
98 }
99
100 IN_PROC_BROWSER_TEST_F(MediaRouterOneUANoReceiverIntegrationBrowserTest,
101 MANUAL_ReconnectSessionSameTab) {
102 RunReconnectSessionSameTabTest();
103 }
104
105 } // namespace media_router
OLDNEW
« no previous file with comments | « chrome/test/media_router/media_router_integration_browsertest.cc ('k') | chrome/test/media_router/resources/common.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698