| 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/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| 11 #include "chrome/browser/infobars/infobar.h" | 11 #include "chrome/browser/infobars/infobar.h" |
| 12 #include "chrome/browser/infobars/infobar_manager.h" | |
| 13 #include "chrome/browser/infobars/infobar_service.h" | 12 #include "chrome/browser/infobars/infobar_service.h" |
| 14 #include "chrome/browser/media/media_stream_infobar_delegate.h" | 13 #include "chrome/browser/media/media_stream_infobar_delegate.h" |
| 15 #include "chrome/browser/media/webrtc_browsertest_common.h" | 14 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| 16 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_tabstrip.h" | 16 #include "chrome/browser/ui/browser_tabstrip.h" |
| 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "content/public/browser/notification_service.h" | 19 #include "content/public/browser/notification_service.h" |
| 21 #include "content/public/test/browser_test_utils.h" | 20 #include "content/public/test/browser_test_utils.h" |
| 22 #include "net/test/embedded_test_server/embedded_test_server.h" | 21 #include "net/test/embedded_test_server/embedded_test_server.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 return tab_contents; | 214 return tab_contents; |
| 216 } | 215 } |
| 217 | 216 |
| 218 void WebRtcTestBase::CloseInfoBarInTab( | 217 void WebRtcTestBase::CloseInfoBarInTab( |
| 219 content::WebContents* tab_contents, | 218 content::WebContents* tab_contents, |
| 220 InfoBar* infobar) const { | 219 InfoBar* infobar) const { |
| 221 content::WindowedNotificationObserver infobar_removed( | 220 content::WindowedNotificationObserver infobar_removed( |
| 222 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, | 221 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, |
| 223 content::NotificationService::AllSources()); | 222 content::NotificationService::AllSources()); |
| 224 | 223 |
| 225 InfoBarManager* infobar_manager = | 224 InfoBarService* infobar_service = |
| 226 InfoBarService::FromWebContents(tab_contents)->infobar_manager(); | 225 InfoBarService::FromWebContents(tab_contents); |
| 227 infobar_manager->RemoveInfoBar(infobar); | 226 infobar_service->RemoveInfoBar(infobar); |
| 228 | 227 |
| 229 infobar_removed.Wait(); | 228 infobar_removed.Wait(); |
| 230 } | 229 } |
| 231 | 230 |
| 232 void WebRtcTestBase::CloseLastLocalStream( | 231 void WebRtcTestBase::CloseLastLocalStream( |
| 233 content::WebContents* tab_contents) const { | 232 content::WebContents* tab_contents) const { |
| 234 EXPECT_EQ("ok-stopped", | 233 EXPECT_EQ("ok-stopped", |
| 235 ExecuteJavascript("stopLocalStream();", tab_contents)); | 234 ExecuteJavascript("stopLocalStream();", tab_contents)); |
| 236 } | 235 } |
| 237 | 236 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 EXPECT_TRUE(StartsWithASCII(result, "ok-", true)); | 310 EXPECT_TRUE(StartsWithASCII(result, "ok-", true)); |
| 312 return result.substr(3); | 311 return result.substr(3); |
| 313 } | 312 } |
| 314 | 313 |
| 315 bool WebRtcTestBase::HasWebcamAvailableOnSystem( | 314 bool WebRtcTestBase::HasWebcamAvailableOnSystem( |
| 316 content::WebContents* tab_contents) const { | 315 content::WebContents* tab_contents) const { |
| 317 std::string result = | 316 std::string result = |
| 318 ExecuteJavascript("HasVideoSourceOnSystem();", tab_contents); | 317 ExecuteJavascript("HasVideoSourceOnSystem();", tab_contents); |
| 319 return result == "has-video-source"; | 318 return result == "has-video-source"; |
| 320 } | 319 } |
| OLD | NEW |