OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/media/webrtc_browsertest_base.h" | 5 #include "chrome/browser/media/webrtc_browsertest_base.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
| 11 #include "chrome/browser/infobars/infobar_manager.h" |
11 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
12 #include "chrome/browser/media/media_stream_infobar_delegate.h" | 13 #include "chrome/browser/media/media_stream_infobar_delegate.h" |
13 #include "chrome/browser/media/webrtc_browsertest_common.h" | 14 #include "chrome/browser/media/webrtc_browsertest_common.h" |
14 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/browser_tabstrip.h" |
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
17 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
18 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
19 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
20 #include "net/test/embedded_test_server/embedded_test_server.h" | 21 #include "net/test/embedded_test_server/embedded_test_server.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return tab_contents; | 202 return tab_contents; |
202 } | 203 } |
203 | 204 |
204 void WebRtcTestBase::CloseInfoBarInTab( | 205 void WebRtcTestBase::CloseInfoBarInTab( |
205 content::WebContents* tab_contents, | 206 content::WebContents* tab_contents, |
206 InfoBar* infobar) const { | 207 InfoBar* infobar) const { |
207 content::WindowedNotificationObserver infobar_removed( | 208 content::WindowedNotificationObserver infobar_removed( |
208 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 209 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
209 content::NotificationService::AllSources()); | 210 content::NotificationService::AllSources()); |
210 | 211 |
211 InfoBarService* infobar_service = | 212 InfoBarManager* infobar_manager = |
212 InfoBarService::FromWebContents(tab_contents); | 213 InfoBarService::FromWebContents(tab_contents)->infobar_manager(); |
213 infobar_service->RemoveInfoBar(infobar); | 214 infobar_manager->RemoveInfoBar(infobar); |
214 | 215 |
215 infobar_removed.Wait(); | 216 infobar_removed.Wait(); |
216 } | 217 } |
217 | 218 |
218 // Convenience method which executes the provided javascript in the context | 219 // Convenience method which executes the provided javascript in the context |
219 // of the provided web contents and returns what it evaluated to. | 220 // of the provided web contents and returns what it evaluated to. |
220 std::string WebRtcTestBase::ExecuteJavascript( | 221 std::string WebRtcTestBase::ExecuteJavascript( |
221 const std::string& javascript, | 222 const std::string& javascript, |
222 content::WebContents* tab_contents) const { | 223 content::WebContents* tab_contents) const { |
223 std::string result; | 224 std::string result; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 std::string javascript = base::StringPrintf( | 275 std::string javascript = base::StringPrintf( |
275 "startDetection('%s', 320, 240)", video_element.c_str()); | 276 "startDetection('%s', 320, 240)", video_element.c_str()); |
276 EXPECT_EQ("ok-started", ExecuteJavascript(javascript, tab_contents)); | 277 EXPECT_EQ("ok-started", ExecuteJavascript(javascript, tab_contents)); |
277 } | 278 } |
278 | 279 |
279 void WebRtcTestBase::WaitForVideoToPlay( | 280 void WebRtcTestBase::WaitForVideoToPlay( |
280 content::WebContents* tab_contents) const { | 281 content::WebContents* tab_contents) const { |
281 EXPECT_TRUE(test::PollingWaitUntil("isVideoPlaying()", "video-playing", | 282 EXPECT_TRUE(test::PollingWaitUntil("isVideoPlaying()", "video-playing", |
282 tab_contents)); | 283 tab_contents)); |
283 } | 284 } |
OLD | NEW |