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

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

Issue 2634213002: [Media Router] Add integration browser tests (Closed)
Patch Set: Created 3 years, 11 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/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" 9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/grit/generated_resources.h" 10 #include "chrome/grit/generated_resources.h"
11 #include "content/public/test/browser_test_utils.h" 11 #include "content/public/test/browser_test_utils.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
14 14
15 namespace media_router { 15 namespace media_router {
16 16
17 namespace { 17 namespace {
18 const char kTestSinkName[] = "test-sink-1"; 18 const char kTestSinkName[] = "test-sink-1";
19 } 19 }
20 20
21 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, MANUAL_Dialog_Basic) { 21 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, MANUAL_Dialog_Basic) {
22 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); 22 OpenTestPage(FILE_PATH_LITERAL("basic_test.html"), browser());
23 content::WebContents* web_contents = 23 content::WebContents* web_contents =
24 browser()->tab_strip_model()->GetActiveWebContents(); 24 browser()->tab_strip_model()->GetActiveWebContents();
25 content::WebContents* dialog_contents = OpenMRDialog(web_contents); 25 content::WebContents* dialog_contents = OpenMRDialog(web_contents);
26 WaitUntilSinkDiscoveredOnUI(); 26 WaitUntilSinkDiscoveredOnUI(web_contents);
27 // Verify the sink list. 27 // Verify the sink list.
28 std::string sink_length_script = base::StringPrintf( 28 std::string sink_length_script = base::StringPrintf(
29 "domAutomationController.send(" 29 "domAutomationController.send("
30 "window.document.getElementById('media-router-container')." 30 "window.document.getElementById('media-router-container')."
31 "sinksToShow_.length)"); 31 "sinksToShow_.length)");
32 ASSERT_GT(ExecuteScriptAndExtractInt(dialog_contents, sink_length_script), 0); 32 ASSERT_GT(ExecuteScriptAndExtractInt(dialog_contents, sink_length_script), 0);
33 LOG(INFO) << "Choose Sink"; 33 LOG(INFO) << "Choose Sink";
34 ChooseSink(web_contents, kTestSinkName); 34 ChooseSink(web_contents, kTestSinkName);
35 35
36 // Linux and Windows bots run browser tests without a physical display, which 36 // Linux and Windows bots run browser tests without a physical display, which
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 #if defined(OS_MACOSX) 131 #if defined(OS_MACOSX)
132 LOG(INFO) << "Waiting for dialog to be closed"; 132 LOG(INFO) << "Waiting for dialog to be closed";
133 WaitUntilDialogClosed(web_contents); 133 WaitUntilDialogClosed(web_contents);
134 #endif 134 #endif
135 LOG(INFO) << "Closed dialog, end of test"; 135 LOG(INFO) << "Closed dialog, end of test";
136 } 136 }
137 137
138 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest, 138 IN_PROC_BROWSER_TEST_F(MediaRouterIntegrationBrowserTest,
139 MANUAL_Dialog_RouteCreationTimedOut) { 139 MANUAL_Dialog_RouteCreationTimedOut) {
140 SetTestData(FILE_PATH_LITERAL("route_creation_timed_out.json")); 140 SetTestData(FILE_PATH_LITERAL("route_creation_timed_out.json"));
141 OpenTestPage(FILE_PATH_LITERAL("basic_test.html")); 141 OpenTestPage(FILE_PATH_LITERAL("basic_test.html"), browser());
142 content::WebContents* web_contents = 142 content::WebContents* web_contents =
143 browser()->tab_strip_model()->GetActiveWebContents(); 143 browser()->tab_strip_model()->GetActiveWebContents();
144 content::WebContents* dialog_contents = OpenMRDialog(web_contents); 144 content::WebContents* dialog_contents = OpenMRDialog(web_contents);
145 145
146 // Verify the sink list. 146 // Verify the sink list.
147 std::string sink_length_script = base::StringPrintf( 147 std::string sink_length_script = base::StringPrintf(
148 "domAutomationController.send(" 148 "domAutomationController.send("
149 "window.document.getElementById('media-router-container')." 149 "window.document.getElementById('media-router-container')."
150 "sinksToShow_.length)"); 150 "sinksToShow_.length)");
151 ASSERT_GT(ExecuteScriptAndExtractInt(dialog_contents, sink_length_script), 0); 151 ASSERT_GT(ExecuteScriptAndExtractInt(dialog_contents, sink_length_script), 0);
(...skipping 14 matching lines...) Expand all
166 // TODO(imcheng): Fix host name for file schemes (crbug.com/560576). 166 // TODO(imcheng): Fix host name for file schemes (crbug.com/560576).
167 ASSERT_EQ(l10n_util::GetStringFUTF8( 167 ASSERT_EQ(l10n_util::GetStringFUTF8(
168 IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT, base::string16()), 168 IDS_MEDIA_ROUTER_ISSUE_CREATE_ROUTE_TIMEOUT, base::string16()),
169 issue_title); 169 issue_title);
170 170
171 // Route will still get created, it just takes longer than usual. 171 // Route will still get created, it just takes longer than usual.
172 WaitUntilRouteCreated(); 172 WaitUntilRouteCreated();
173 } 173 }
174 174
175 } // namespace media_router 175 } // namespace media_router
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698