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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return tab_contents; | 201 return tab_contents; |
201 } | 202 } |
202 | 203 |
203 void WebRtcTestBase::CloseInfoBarInTab( | 204 void WebRtcTestBase::CloseInfoBarInTab( |
204 content::WebContents* tab_contents, | 205 content::WebContents* tab_contents, |
205 InfoBar* infobar) const { | 206 InfoBar* infobar) const { |
206 content::WindowedNotificationObserver infobar_removed( | 207 content::WindowedNotificationObserver infobar_removed( |
207 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 208 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
208 content::NotificationService::AllSources()); | 209 content::NotificationService::AllSources()); |
209 | 210 |
210 InfoBarService* infobar_service = | 211 InfoBarManager& infobar_manager = |
211 InfoBarService::FromWebContents(tab_contents); | 212 InfoBarService::FromWebContents(tab_contents)->infobar_manager(); |
212 infobar_service->RemoveInfoBar(infobar); | 213 infobar_manager.RemoveInfoBar(infobar); |
213 | 214 |
214 infobar_removed.Wait(); | 215 infobar_removed.Wait(); |
215 } | 216 } |
216 | 217 |
217 // Convenience method which executes the provided javascript in the context | 218 // Convenience method which executes the provided javascript in the context |
218 // of the provided web contents and returns what it evaluated to. | 219 // of the provided web contents and returns what it evaluated to. |
219 std::string WebRtcTestBase::ExecuteJavascript( | 220 std::string WebRtcTestBase::ExecuteJavascript( |
220 const std::string& javascript, | 221 const std::string& javascript, |
221 content::WebContents* tab_contents) const { | 222 content::WebContents* tab_contents) const { |
222 std::string result; | 223 std::string result; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 std::string javascript = base::StringPrintf( | 274 std::string javascript = base::StringPrintf( |
274 "startDetection('%s', 320, 240)", video_element.c_str()); | 275 "startDetection('%s', 320, 240)", video_element.c_str()); |
275 EXPECT_EQ("ok-started", ExecuteJavascript(javascript, tab_contents)); | 276 EXPECT_EQ("ok-started", ExecuteJavascript(javascript, tab_contents)); |
276 } | 277 } |
277 | 278 |
278 void WebRtcTestBase::WaitForVideoToPlay( | 279 void WebRtcTestBase::WaitForVideoToPlay( |
279 content::WebContents* tab_contents) const { | 280 content::WebContents* tab_contents) const { |
280 EXPECT_TRUE(PollingWaitUntil("isVideoPlaying()", "video-playing", | 281 EXPECT_TRUE(PollingWaitUntil("isVideoPlaying()", "video-playing", |
281 tab_contents)); | 282 tab_contents)); |
282 } | 283 } |
OLD | NEW |