| 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," and starts a session. |
| 78 content::WebContents* StartSessionWithTestPageNow(); |
| 79 // Opens "basic_test.html," waits for sinks to be available, and starts a |
| 80 // session. |
| 81 content::WebContents* StartSessionWithTestPageAndSink(); |
| 82 |
| 83 // Opens "basic_test.html," waits for sinks to be available, starts a session, |
| 84 // and chooses a sink with the name |kTestSinkName|. Also checks that the |
| 85 // session has successfully started if |should_succeed| is true. |
| 86 content::WebContents* StartSessionWithTestPageAndChooseSink(); |
| 87 |
| 77 void OpenTestPage(base::FilePath::StringPieceType file); | 88 void OpenTestPage(base::FilePath::StringPieceType file); |
| 78 void OpenTestPageInNewTab(base::FilePath::StringPieceType file); | 89 void OpenTestPageInNewTab(base::FilePath::StringPieceType file); |
| 79 | 90 |
| 80 void SetTestData(base::FilePath::StringPieceType test_data_file); | 91 void SetTestData(base::FilePath::StringPieceType test_data_file); |
| 81 | 92 |
| 82 // Start session and wait until the pop dialog shows up. | 93 // Start session and wait until the pop dialog shows up. |
| 83 // |web_contents|: The web contents of the test page which invokes the popup | 94 // |web_contents|: The web contents of the test page which invokes the popup |
| 84 // dialog. | 95 // dialog. |
| 85 void StartSession(content::WebContents* web_contents); | 96 void StartSession(content::WebContents* web_contents); |
| 86 | 97 |
| (...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 | 129 // Wait for the specific sink shows up in UI with a timeout. Fails if the sink |
| 119 // doesn't show up before the timeout. | 130 // doesn't show up before the timeout. |
| 120 void WaitUntilSinkDiscoveredOnUI(); | 131 void WaitUntilSinkDiscoveredOnUI(); |
| 121 | 132 |
| 122 // Checks if media router dialog is fully loaded. | 133 // Checks if media router dialog is fully loaded. |
| 123 bool IsDialogLoaded(content::WebContents* dialog_contents); | 134 bool IsDialogLoaded(content::WebContents* dialog_contents); |
| 124 | 135 |
| 125 // Wait until media router dialog is fully loaded. | 136 // Wait until media router dialog is fully loaded. |
| 126 void WaitUntilDialogFullyLoaded(content::WebContents* dialog_contents); | 137 void WaitUntilDialogFullyLoaded(content::WebContents* dialog_contents); |
| 127 | 138 |
| 139 // Checks that the session started for |web_contents| has connected and is the |
| 140 // default session. |
| 141 void CheckSessionValidity(content::WebContents* web_contents); |
| 142 |
| 143 // Checks that a Media Router dialog is shown for |web_contents|, and returns |
| 144 // its controller. |
| 145 MediaRouterDialogControllerImpl* GetControllerForShownDialog( |
| 146 content::WebContents* web_contents); |
| 147 |
| 148 // Returns the active WebContents for the current window. |
| 149 content::WebContents* GetActiveWebContents(); |
| 150 |
| 151 // Runs a basic test in which a session is created through the MediaRouter |
| 152 // dialog, then terminated. |
| 153 void RunBasicTest(); |
| 154 |
| 155 // Runs a test in which we start a session and reconnect to it from another |
| 156 // tab. |
| 157 void RunReconnectSessionTest(); |
| 158 |
| 128 std::string receiver() const { return receiver_; } | 159 std::string receiver() const { return receiver_; } |
| 129 | 160 |
| 130 private: | 161 private: |
| 131 // Get the full path of the resource file. | 162 // Get the full path of the resource file. |
| 132 // |relative_path|: The relative path to | 163 // |relative_path|: The relative path to |
| 133 // <chromium src>/out/<build config>/media_router/ | 164 // <chromium src>/out/<build config>/media_router/ |
| 134 // browser_test_resources/ | 165 // browser_test_resources/ |
| 135 base::FilePath GetResourceFile( | 166 base::FilePath GetResourceFile( |
| 136 base::FilePath::StringPieceType relative_path) const; | 167 base::FilePath::StringPieceType relative_path) const; |
| 137 | 168 |
| 138 std::unique_ptr<content::TestNavigationObserver> test_navigation_observer_; | 169 std::unique_ptr<content::TestNavigationObserver> test_navigation_observer_; |
| 139 | 170 |
| 140 // Fields | 171 // Fields |
| 141 std::string receiver_; | 172 std::string receiver_; |
| 142 }; | 173 }; |
| 143 | 174 |
| 175 class MediaRouterIntegrationIncognitoBrowserTest |
| 176 : public MediaRouterIntegrationBrowserTest { |
| 177 public: |
| 178 void InstallAndEnableMRExtension() override; |
| 179 void UninstallMRExtension() override; |
| 180 Browser* browser() override; |
| 181 |
| 182 private: |
| 183 Browser* incognito_browser_ = nullptr; |
| 184 std::string incognito_extension_id_; |
| 185 }; |
| 186 |
| 144 } // namespace media_router | 187 } // namespace media_router |
| 145 | 188 |
| 146 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_ | 189 #endif // CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_INTEGRATION_BROWSERTEST_H_ |
| OLD | NEW |