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

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

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 #ifndef CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_ 5 #ifndef CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_
6 #define CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_ 6 #define CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // |web_contents|: The web contents of the test page which invokes the popup 67 // |web_contents|: The web contents of the test page which invokes the popup
68 // dialog. 68 // dialog.
69 content::WebContents* GetMRDialog(content::WebContents* web_contents); 69 content::WebContents* GetMRDialog(content::WebContents* web_contents);
70 70
71 // Checks that the chrome modal dialog does not exist. 71 // Checks that the chrome modal dialog does not exist.
72 bool IsDialogClosed(content::WebContents* web_contents); 72 bool IsDialogClosed(content::WebContents* web_contents);
73 void WaitUntilDialogClosed(content::WebContents* web_contents); 73 void WaitUntilDialogClosed(content::WebContents* web_contents);
74 74
75 void CheckDialogRemainsOpen(content::WebContents* web_contents); 75 void CheckDialogRemainsOpen(content::WebContents* web_contents);
76 76
77 void OpenTestPage(base::FilePath::StringPieceType file); 77 // Opens "basic_test.html," waits for sinks to be available, and starts a
78 void OpenTestPageInNewTab(base::FilePath::StringPieceType file); 78 // session in |browser|.
79 void StartSessionWithTestPage(Browser* browser);
mark a. foltz 2017/01/20 19:00:09 Here's a thought. We could run all the test cases
takumif 2017/02/07 22:17:35 I made a subclass of MediaRouterIntegrationBrowser
80
81 // Opens "basic_test.html," waits for sinks to be available, starts a session,
82 // and chooses a sink with the name |kTestSinkName| in |browser|.
83 void StartSessionWithTestPageAndChooseSink(Browser* browser);
84
85 void OpenTestPage(base::FilePath::StringPieceType file, Browser* browser);
86 void OpenTestPageInNewTab(base::FilePath::StringPieceType file,
87 Browser* browser);
79 88
80 void SetTestData(base::FilePath::StringPieceType test_data_file); 89 void SetTestData(base::FilePath::StringPieceType test_data_file);
81 90
82 // Start session and wait until the pop dialog shows up. 91 // Start session and wait until the pop dialog shows up.
83 // |web_contents|: The web contents of the test page which invokes the popup 92 // |web_contents|: The web contents of the test page which invokes the popup
84 // dialog. 93 // dialog.
85 void StartSession(content::WebContents* web_contents); 94 void StartSession(content::WebContents* web_contents);
86 95
87 // Open the chrome modal dialog. 96 // Open the chrome modal dialog.
88 // |web_contents|: The web contents of the test page which invokes the popup 97 // |web_contents|: The web contents of the test page which invokes the popup
89 // dialog. 98 // dialog.
90 content::WebContents* OpenMRDialog(content::WebContents* web_contents); 99 content::WebContents* OpenMRDialog(content::WebContents* web_contents);
91 100
92 bool IsRouteCreatedOnUI(); 101 bool IsRouteCreatedOnUI();
93 102
94 bool IsRouteClosedOnUI(); 103 bool IsRouteClosedOnUI();
95 104
96 bool IsSinkDiscoveredOnUI(); 105 bool IsSinkDiscoveredOnUI(content::WebContents* web_contents);
97 106
98 // Close route through clicking 'Stop casting' button in route details dialog. 107 // Close route through clicking 'Stop casting' button in route details dialog.
99 void CloseRouteOnUI(); 108 void CloseRouteOnUI();
100 109
101 // Wait for the route to show up in the UI with a timeout. Fails if the 110 // Wait for the route to show up in the UI with a timeout. Fails if the
102 // route did not show up before the timeout. 111 // route did not show up before the timeout.
103 void WaitUntilRouteCreated(); 112 void WaitUntilRouteCreated();
104 113
105 // Wait until there is an issue showing in the UI. 114 // Wait until there is an issue showing in the UI.
106 void WaitUntilIssue(); 115 void WaitUntilIssue();
107 116
108 // Returns true if there is an issue showing in the UI. 117 // Returns true if there is an issue showing in the UI.
109 bool IsUIShowingIssue(); 118 bool IsUIShowingIssue();
110 119
111 // Returns the title of issue showing in UI. It is an error to call this if 120 // Returns the title of issue showing in UI. It is an error to call this if
112 // there are no issues showing in UI. 121 // there are no issues showing in UI.
113 std::string GetIssueTitle(); 122 std::string GetIssueTitle();
114 123
115 // Returns the route ID for the specific sink. 124 // Returns the route ID for the specific sink.
116 std::string GetRouteId(const std::string& sink_id); 125 std::string GetRouteId(const std::string& sink_id);
117 126
118 // Wait for the specific sink shows up in UI with a timeout. Fails if the sink 127 // Waits for the specific sink shows up in a media router dialog shown for
119 // doesn't show up before the timeout. 128 // |web_contents| with a timeout. Fails if the sink doesn't show up before the
120 void WaitUntilSinkDiscoveredOnUI(); 129 // timeout.
130 void WaitUntilSinkDiscoveredOnUI(content::WebContents* web_contents);
121 131
122 // Checks if media router dialog is fully loaded. 132 // Checks if media router dialog is fully loaded.
123 bool IsDialogLoaded(content::WebContents* dialog_contents); 133 bool IsDialogLoaded(content::WebContents* dialog_contents);
124 134
125 // Wait until media router dialog is fully loaded. 135 // Wait until media router dialog is fully loaded.
126 void WaitUntilDialogFullyLoaded(content::WebContents* dialog_contents); 136 void WaitUntilDialogFullyLoaded(content::WebContents* dialog_contents);
127 137
138 // Checks that the session started for |web_contents| has connected and is the
139 // default session.
140 void CheckSessionValidity(content::WebContents* web_contents);
141
142 void RunBasicTest(Browser* browser);
143
144 void RunReconnectSessionTest(Browser* browser);
145
128 std::string receiver() const { return receiver_; } 146 std::string receiver() const { return receiver_; }
129 147
130 private: 148 private:
131 // Get the full path of the resource file. 149 // Get the full path of the resource file.
132 // |relative_path|: The relative path to 150 // |relative_path|: The relative path to
133 // <chromium src>/out/<build config>/media_router/ 151 // <chromium src>/out/<build config>/media_router/
134 // browser_test_resources/ 152 // browser_test_resources/
135 base::FilePath GetResourceFile( 153 base::FilePath GetResourceFile(
136 base::FilePath::StringPieceType relative_path) const; 154 base::FilePath::StringPieceType relative_path) const;
137 155
138 std::unique_ptr<content::TestNavigationObserver> test_navigation_observer_; 156 std::unique_ptr<content::TestNavigationObserver> test_navigation_observer_;
139 157
140 // Fields 158 // Fields
141 std::string receiver_; 159 std::string receiver_;
142 }; 160 };
143 161
144 } // namespace media_router 162 } // namespace media_router
145 163
146 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_ 164 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698