| 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 "base/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return result; | 131 return result; |
| 132 } | 132 } |
| 133 | 133 |
| 134 void GetUserMedia(content::WebContents* tab_contents) { | 134 void GetUserMedia(content::WebContents* tab_contents) { |
| 135 content::WindowedNotificationObserver infobar_added( | 135 content::WindowedNotificationObserver infobar_added( |
| 136 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, | 136 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, |
| 137 content::NotificationService::AllSources()); | 137 content::NotificationService::AllSources()); |
| 138 | 138 |
| 139 // Request user media: this will launch the media stream info bar. | 139 // Request user media: this will launch the media stream info bar. |
| 140 EXPECT_EQ("ok-requested", ExecuteJavascript( | 140 EXPECT_EQ("ok-requested", ExecuteJavascript( |
| 141 "getUserMedia('{video: true, audio: true}');", tab_contents)); | 141 "doGetUserMedia('{video: true, audio: true}');", tab_contents)); |
| 142 | 142 |
| 143 // Wait for the bar to pop up, then accept. | 143 // Wait for the bar to pop up, then accept. |
| 144 infobar_added.Wait(); | 144 infobar_added.Wait(); |
| 145 content::Details<InfoBarAddedDetails> details(infobar_added.details()); | 145 content::Details<InfoBarAddedDetails> details(infobar_added.details()); |
| 146 MediaStreamInfoBarDelegate* media_infobar = | 146 MediaStreamInfoBarDelegate* media_infobar = |
| 147 details.ptr()->AsMediaStreamInfoBarDelegate(); | 147 details.ptr()->AsMediaStreamInfoBarDelegate(); |
| 148 media_infobar->Accept(); | 148 media_infobar->Accept(); |
| 149 | 149 |
| 150 // Wait for WebRTC to call the success callback. | 150 // Wait for WebRTC to call the success callback. |
| 151 EXPECT_TRUE(UglyPollingWaitUntil("obtainGetUserMediaResult();", | 151 EXPECT_TRUE(UglyPollingWaitUntil("obtainGetUserMediaResult();", |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 multipart_lines[25].c_str()); | 503 multipart_lines[25].c_str()); |
| 504 EXPECT_STREQ("Content-Type: application/gzip", | 504 EXPECT_STREQ("Content-Type: application/gzip", |
| 505 multipart_lines[26].c_str()); | 505 multipart_lines[26].c_str()); |
| 506 EXPECT_TRUE(multipart_lines[27].empty()); | 506 EXPECT_TRUE(multipart_lines[27].empty()); |
| 507 EXPECT_TRUE(multipart_lines[28].empty()); // The removed zip part. | 507 EXPECT_TRUE(multipart_lines[28].empty()); // The removed zip part. |
| 508 std::string final_delimiter = boundary; | 508 std::string final_delimiter = boundary; |
| 509 final_delimiter += "--"; | 509 final_delimiter += "--"; |
| 510 EXPECT_STREQ(final_delimiter.c_str(), multipart_lines[29].c_str()); | 510 EXPECT_STREQ(final_delimiter.c_str(), multipart_lines[29].c_str()); |
| 511 EXPECT_TRUE(multipart_lines[30].empty()); | 511 EXPECT_TRUE(multipart_lines[30].empty()); |
| 512 } | 512 } |
| OLD | NEW |