Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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," waits for sinks to be available if |wait_for_sink| | |
| 78 // is true, and starts a session. | |
| 79 content::WebContents* StartSessionWithTestPage(bool wait_for_sink); | |
|
mark a. foltz
2017/02/09 23:29:59
Slight preference for having explicit functions St
takumif
2017/02/14 19:11:48
It does result in a bit of code duplication, but t
| |
| 80 | |
| 81 // Opens "basic_test.html," waits for sinks to be available, starts a session, | |
| 82 // and chooses a sink with the name |kTestSinkName|. Also checks that the | |
| 83 // session has successfully started if |should_succeed| is true. | |
| 84 content::WebContents* StartSessionWithTestPageAndChooseSink( | |
|
mark a. foltz
2017/02/09 23:29:59
Maybe the caller could choose to call CheckSession
takumif
2017/02/14 19:11:48
Done.
| |
| 85 bool should_succeed); | |
| 86 | |
| 77 void OpenTestPage(base::FilePath::StringPieceType file); | 87 void OpenTestPage(base::FilePath::StringPieceType file); |
| 78 void OpenTestPageInNewTab(base::FilePath::StringPieceType file); | 88 void OpenTestPageInNewTab(base::FilePath::StringPieceType file); |
| 79 | 89 |
| 80 void SetTestData(base::FilePath::StringPieceType test_data_file); | 90 void SetTestData(base::FilePath::StringPieceType test_data_file); |
| 81 | 91 |
| 82 // Start session and wait until the pop dialog shows up. | 92 // Start session and wait until the pop dialog shows up. |
| 83 // |web_contents|: The web contents of the test page which invokes the popup | 93 // |web_contents|: The web contents of the test page which invokes the popup |
| 84 // dialog. | 94 // dialog. |
| 85 void StartSession(content::WebContents* web_contents); | 95 void StartSession(content::WebContents* web_contents); |
| 86 | 96 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 // Wait for the specific sink shows up in UI with a timeout. Fails if the sink | 128 // Wait for the specific sink shows up in UI with a timeout. Fails if the sink |
| 119 // doesn't show up before the timeout. | 129 // doesn't show up before the timeout. |
| 120 void WaitUntilSinkDiscoveredOnUI(); | 130 void WaitUntilSinkDiscoveredOnUI(); |
| 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 // Hides the dialog shown for |web_contents| after waiting for a sink to | |
| 143 // appear if |wait_for_sink| is true, or immediately if false. | |
| 144 void HideMediaRouterDialog(content::WebContents* web_contents, | |
|
mark a. foltz
2017/02/09 23:29:59
HideMediaRouterDialogNow() and HideMediaRouterDial
takumif
2017/02/14 19:11:48
Factored out the common part into GetControllerFor
| |
| 145 bool wait_for_sink); | |
| 146 | |
| 147 // Returns the active WebContents for the current window. | |
| 148 content::WebContents* GetActiveWebContents(); | |
| 149 | |
| 150 // Runs a basic test in which a session is created through the MediaRouter | |
| 151 // dialog, then terminated. | |
| 152 void RunBasicTest(); | |
| 153 | |
| 154 // Runs a test in which we start a session and reconnect to it from another | |
| 155 // tab. | |
| 156 void RunReconnectSessionTest(); | |
| 157 | |
| 128 std::string receiver() const { return receiver_; } | 158 std::string receiver() const { return receiver_; } |
| 129 | 159 |
| 130 private: | 160 private: |
| 131 // Get the full path of the resource file. | 161 // Get the full path of the resource file. |
| 132 // |relative_path|: The relative path to | 162 // |relative_path|: The relative path to |
| 133 // <chromium src>/out/<build config>/media_router/ | 163 // <chromium src>/out/<build config>/media_router/ |
| 134 // browser_test_resources/ | 164 // browser_test_resources/ |
| 135 base::FilePath GetResourceFile( | 165 base::FilePath GetResourceFile( |
| 136 base::FilePath::StringPieceType relative_path) const; | 166 base::FilePath::StringPieceType relative_path) const; |
| 137 | 167 |
| 138 std::unique_ptr<content::TestNavigationObserver> test_navigation_observer_; | 168 std::unique_ptr<content::TestNavigationObserver> test_navigation_observer_; |
| 139 | 169 |
| 140 // Fields | 170 // Fields |
| 141 std::string receiver_; | 171 std::string receiver_; |
| 142 }; | 172 }; |
| 143 | 173 |
| 174 class MediaRouterIntegrationIncognitoBrowserTest | |
| 175 : public MediaRouterIntegrationBrowserTest { | |
| 176 public: | |
| 177 void InstallAndEnableMRExtension() override; | |
| 178 void UninstallMRExtension() override; | |
| 179 Browser* browser() override; | |
| 180 | |
| 181 private: | |
| 182 Browser* browser_ = nullptr; | |
|
mark a. foltz
2017/02/09 23:29:59
Does this hide a member in the superclass? Maybe
takumif
2017/02/14 19:11:48
Done. Also renaming extension_id_ to incognito_ext
| |
| 183 std::string extension_id_; | |
| 184 }; | |
| 185 | |
| 144 } // namespace media_router | 186 } // namespace media_router |
| 145 | 187 |
| 146 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_ | 188 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_ |
| OLD | NEW |