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

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

Issue 1228863005: [MediaRouter] The minimal change to make everything build on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo in a chrome/test/BUILD.gn Created 5 years, 5 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
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 "chrome/test/media_router/media_router_integration_browsertest.h" 5 #include "chrome/test/media_router/media_router_integration_browsertest.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/browser_finder.h" 12 #include "chrome/browser/ui/browser_finder.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 13 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller.h" 14 #include "chrome/browser/ui/webui/media_router/media_router_dialog_controller_im pl.h"
15 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
16 #include "content/public/test/browser_test_utils.h" 16 #include "content/public/test/browser_test_utils.h"
17 #include "content/public/test/test_navigation_observer.h" 17 #include "content/public/test/test_navigation_observer.h"
18 #include "content/public/test/test_utils.h" 18 #include "content/public/test/test_utils.h"
19 #include "net/base/filename_util.h" 19 #include "net/base/filename_util.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 namespace media_router { 22 namespace media_router {
23 23
24 MediaRouterIntegrationBrowserTest::MediaRouterIntegrationBrowserTest() { 24 MediaRouterIntegrationBrowserTest::MediaRouterIntegrationBrowserTest() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 base::FilePath full_path = 61 base::FilePath full_path =
62 base_dir.Append(FILE_PATH_LITERAL("media_router/browser_test_resources/")) 62 base_dir.Append(FILE_PATH_LITERAL("media_router/browser_test_resources/"))
63 .Append(file_name); 63 .Append(file_name);
64 ASSERT_TRUE(PathExists(full_path)); 64 ASSERT_TRUE(PathExists(full_path));
65 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(full_path)); 65 ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(full_path));
66 } 66 }
67 67
68 void MediaRouterIntegrationBrowserTest::ChooseSink( 68 void MediaRouterIntegrationBrowserTest::ChooseSink(
69 content::WebContents* web_contents, 69 content::WebContents* web_contents,
70 const std::string& sink_id) { 70 const std::string& sink_id) {
71 MediaRouterDialogController* controller = 71 MediaRouterDialogControllerImpl* controller =
72 MediaRouterDialogController::GetOrCreateForWebContents(web_contents); 72 MediaRouterDialogControllerImpl::GetOrCreateForWebContents(web_contents);
73 content::WebContents* dialog_contents = controller->GetMediaRouterDialog(); 73 content::WebContents* dialog_contents = controller->GetMediaRouterDialog();
74 ASSERT_TRUE(dialog_contents); 74 ASSERT_TRUE(dialog_contents);
75 std::string script = base::StringPrintf( 75 std::string script = base::StringPrintf(
76 "window.document.getElementById('media-router-container')." 76 "window.document.getElementById('media-router-container')."
77 "showOrCreateRoute_({'id': '%s', 'name': ''}, null)", 77 "showOrCreateRoute_({'id': '%s', 'name': ''}, null)",
78 sink_id.c_str()); 78 sink_id.c_str());
79 ASSERT_TRUE(content::ExecuteScript(dialog_contents, script)); 79 ASSERT_TRUE(content::ExecuteScript(dialog_contents, script));
80 } 80 }
81 81
82 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, MANUAL_Basic) { 82 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, MANUAL_Basic) {
83 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); 83 OpenTestPage(FILE_PATH_LITERAL("basic_test.html"));
84 content::WebContents* web_contents = 84 content::WebContents* web_contents =
85 browser()->tab_strip_model()->GetActiveWebContents(); 85 browser()->tab_strip_model()->GetActiveWebContents();
86 ASSERT_TRUE(web_contents); 86 ASSERT_TRUE(web_contents);
87 ExecuteJavaScriptAPI(web_contents, "waitUntilDeviceAvailable();"); 87 ExecuteJavaScriptAPI(web_contents, "waitUntilDeviceAvailable();");
88 content::TestNavigationObserver test_navigation_observer(web_contents, 1); 88 content::TestNavigationObserver test_navigation_observer(web_contents, 1);
89 test_navigation_observer.StartWatchingNewWebContents(); 89 test_navigation_observer.StartWatchingNewWebContents();
90 ExecuteJavaScriptAPI(web_contents, "startSession();"); 90 ExecuteJavaScriptAPI(web_contents, "startSession();");
91 test_navigation_observer.Wait(); 91 test_navigation_observer.Wait();
92 ChooseSink(web_contents, "id1"); 92 ChooseSink(web_contents, "id1");
93 ExecuteJavaScriptAPI(web_contents, "checkSession();"); 93 ExecuteJavaScriptAPI(web_contents, "checkSession();");
94 Wait(base::TimeDelta::FromSeconds(5)); 94 Wait(base::TimeDelta::FromSeconds(5));
95 ExecuteJavaScriptAPI(web_contents, "stopSession();"); 95 ExecuteJavaScriptAPI(web_contents, "stopSession();");
96 } 96 }
97 97
98 } // namespace media_router 98 } // namespace media_router
OLDNEW
« chrome/chrome_browser.gypi ('K') | « chrome/test/media_router/media_router_e2e_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698