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

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

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
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 19 matching lines...) Expand all
30 // MediaRouterBaseBrowserTest Overrides 30 // MediaRouterBaseBrowserTest Overrides
31 void ParseCommandLine() override; 31 void ParseCommandLine() override;
32 32
33 // Simulate user action to choose one sink in the popup dialog. 33 // Simulate user action to choose one sink in the popup dialog.
34 // |web_contents|: The web contents of the test page which invokes the popup 34 // |web_contents|: The web contents of the test page which invokes the popup
35 // dialog. 35 // dialog.
36 // |sink_name|: The sink's human readable name. 36 // |sink_name|: The sink's human readable name.
37 void ChooseSink(content::WebContents* web_contents, 37 void ChooseSink(content::WebContents* web_contents,
38 const std::string& sink_name); 38 const std::string& sink_name);
39 39
40 // Checks that the request initiated from |web_contents| to start session 40 // Checks that the request initiated from |web_contents| to start presentation
41 // failed with expected |error_name| and |error_message_substring|. 41 // failed with expected |error_name| and |error_message_substring|.
42 void CheckStartFailed(content::WebContents* web_contents, 42 void CheckStartFailed(content::WebContents* web_contents,
43 const std::string& error_name, 43 const std::string& error_name,
44 const std::string& error_message_substring); 44 const std::string& error_message_substring);
45 45
46 // Execute javascript and check the return value. 46 // Execute javascript and check the return value.
47 static void ExecuteJavaScriptAPI(content::WebContents* web_contents, 47 static void ExecuteJavaScriptAPI(content::WebContents* web_contents,
48 const std::string& script); 48 const std::string& script);
49 49
50 static int ExecuteScriptAndExtractInt( 50 static int ExecuteScriptAndExtractInt(
(...skipping 16 matching lines...) Expand all
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 // Opens "basic_test.html," and starts a session. 77 // Opens "basic_test.html," and starts a presentation.
78 content::WebContents* StartSessionWithTestPageNow(); 78 content::WebContents* StartSessionWithTestPageNow();
79 // Opens "basic_test.html," waits for sinks to be available, and starts a 79 // Opens "basic_test.html," waits for sinks to be available, and starts a
80 // session. 80 // presentation.
81 content::WebContents* StartSessionWithTestPageAndSink(); 81 content::WebContents* StartSessionWithTestPageAndSink();
82 82
83 // Opens "basic_test.html," waits for sinks to be available, starts a session, 83 // Opens "basic_test.html," waits for sinks to be available, starts a
84 // and chooses a sink with the name |kTestSinkName|. Also checks that the 84 // presentation, and chooses a sink with the name |kTestSinkName|. Also checks
85 // session has successfully started if |should_succeed| is true. 85 // that the presentation has successfully started if |should_succeed| is true.
86 content::WebContents* StartSessionWithTestPageAndChooseSink(); 86 content::WebContents* StartSessionWithTestPageAndChooseSink();
87 87
88 void OpenTestPage(base::FilePath::StringPieceType file); 88 void OpenTestPage(base::FilePath::StringPieceType file);
89 void OpenTestPageInNewTab(base::FilePath::StringPieceType file); 89 void OpenTestPageInNewTab(base::FilePath::StringPieceType file);
90 virtual GURL GetTestPageUrl(const base::FilePath& full_path);
90 91
91 void SetTestData(base::FilePath::StringPieceType test_data_file); 92 void SetTestData(base::FilePath::StringPieceType test_data_file);
92 93
93 // Start session and wait until the pop dialog shows up. 94 // Start presentation and wait until the pop dialog shows up.
94 // |web_contents|: The web contents of the test page which invokes the popup 95 // |web_contents|: The web contents of the test page which invokes the popup
95 // dialog. 96 // dialog.
96 void StartSession(content::WebContents* web_contents); 97 void StartSession(content::WebContents* web_contents);
97 98
98 // Open the chrome modal dialog. 99 // Open the chrome modal dialog.
99 // |web_contents|: The web contents of the test page which invokes the popup 100 // |web_contents|: The web contents of the test page which invokes the popup
100 // dialog. 101 // dialog.
101 content::WebContents* OpenMRDialog(content::WebContents* web_contents); 102 content::WebContents* OpenMRDialog(content::WebContents* web_contents);
102 103
103 bool IsRouteCreatedOnUI(); 104 bool IsRouteCreatedOnUI();
(...skipping 25 matching lines...) Expand all
129 // Wait for the specific sink shows up in UI with a timeout. Fails if the sink 130 // Wait for the specific sink shows up in UI with a timeout. Fails if the sink
130 // doesn't show up before the timeout. 131 // doesn't show up before the timeout.
131 void WaitUntilSinkDiscoveredOnUI(); 132 void WaitUntilSinkDiscoveredOnUI();
132 133
133 // Checks if media router dialog is fully loaded. 134 // Checks if media router dialog is fully loaded.
134 bool IsDialogLoaded(content::WebContents* dialog_contents); 135 bool IsDialogLoaded(content::WebContents* dialog_contents);
135 136
136 // Wait until media router dialog is fully loaded. 137 // Wait until media router dialog is fully loaded.
137 void WaitUntilDialogFullyLoaded(content::WebContents* dialog_contents); 138 void WaitUntilDialogFullyLoaded(content::WebContents* dialog_contents);
138 139
139 // Checks that the session started for |web_contents| has connected and is the 140 // Checks that the presentation started for |web_contents| has connected and
140 // default session. 141 // is the default presentation.
141 void CheckSessionValidity(content::WebContents* web_contents); 142 void CheckSessionValidity(content::WebContents* web_contents);
142 143
143 // Checks that a Media Router dialog is shown for |web_contents|, and returns 144 // Checks that a Media Router dialog is shown for |web_contents|, and returns
144 // its controller. 145 // its controller.
145 MediaRouterDialogControllerImpl* GetControllerForShownDialog( 146 MediaRouterDialogControllerImpl* GetControllerForShownDialog(
146 content::WebContents* web_contents); 147 content::WebContents* web_contents);
147 148
148 // Returns the active WebContents for the current window. 149 // Returns the active WebContents for the current window.
149 content::WebContents* GetActiveWebContents(); 150 content::WebContents* GetActiveWebContents();
150 151
151 // Runs a basic test in which a session is created through the MediaRouter 152 // Runs a basic test in which a presentation is created through the
152 // dialog, then terminated. 153 // MediaRouter dialog, then terminated.
153 void RunBasicTest(); 154 void RunBasicTest();
154 155
155 // Runs a test in which we start a session and reconnect to it from another 156 // Runs a test in which we start a presentation and send a message.
156 // tab. 157 void RunSendMessageTest(const std::string& message);
158
159 // Runs a test in which we start a presentation, close it and send a message.
160 void RunFailToSendMessageTest();
161
162 // Runs a test in which we start a presentation and reconnect to it from
163 // another tab.
157 void RunReconnectSessionTest(); 164 void RunReconnectSessionTest();
158 165
166 // Runs a test in which we start a presentation and reconnect to it from the
167 // same tab.
168 void RunReconnectSessionSameTabTest();
169
159 std::string receiver() const { return receiver_; } 170 std::string receiver() const { return receiver_; }
160 171
161 private: 172 private:
162 // Get the full path of the resource file. 173 // Get the full path of the resource file.
163 // |relative_path|: The relative path to 174 // |relative_path|: The relative path to
164 // <chromium src>/out/<build config>/media_router/ 175 // <chromium src>/out/<build config>/media_router/
165 // browser_test_resources/ 176 // browser_test_resources/
166 base::FilePath GetResourceFile( 177 base::FilePath GetResourceFile(
167 base::FilePath::StringPieceType relative_path) const; 178 base::FilePath::StringPieceType relative_path) const;
168 179
(...skipping 11 matching lines...) Expand all
180 Browser* browser() override; 191 Browser* browser() override;
181 192
182 private: 193 private:
183 Browser* incognito_browser_ = nullptr; 194 Browser* incognito_browser_ = nullptr;
184 std::string incognito_extension_id_; 195 std::string incognito_extension_id_;
185 }; 196 };
186 197
187 } // namespace media_router 198 } // namespace media_router
188 199
189 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_ 200 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_
OLDNEW
« no previous file with comments | « chrome/test/media_router/BUILD.gn ('k') | chrome/test/media_router/media_router_integration_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698