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_common.h" | 5 #include "chrome/browser/media/webrtc_browsertest_common.h" |
6 | 6 |
7 #include "base/file_util.h" | |
8 #include "base/path_service.h" | 7 #include "base/path_service.h" |
9 #include "base/process_util.h" | |
10 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
11 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
12 #include "base/time/time.h" | 10 #include "base/time/time.h" |
13 #include "chrome/browser/chrome_notification_types.h" | |
14 #include "chrome/browser/infobars/infobar.h" | |
15 #include "chrome/browser/infobars/infobar_service.h" | |
16 #include "chrome/browser/media/media_stream_infobar_delegate.h" | |
17 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/ui/browser.h" | |
19 #include "chrome/browser/ui/browser_tabstrip.h" | 12 #include "chrome/browser/ui/browser_tabstrip.h" |
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
21 #include "chrome/common/chrome_switches.h" | |
22 #include "chrome/test/base/in_process_browser_test.h" | |
23 #include "chrome/test/base/ui_test_utils.h" | |
24 #include "chrome/test/ui/ui_test.h" | |
25 #include "content/public/browser/notification_service.h" | |
26 #include "content/public/test/browser_test_utils.h" | 13 #include "content/public/test/browser_test_utils.h" |
27 #include "net/test/embedded_test_server/embedded_test_server.h" | |
28 | 14 |
29 const int kDefaultPollIntervalMsec = 250; | 15 const int kDefaultPollIntervalMsec = 250; |
30 | 16 |
31 bool SleepInJavascript(content::WebContents* tab_contents, int timeout_msec) { | 17 bool SleepInJavascript(content::WebContents* tab_contents, int timeout_msec) { |
32 const std::string javascript = base::StringPrintf( | 18 const std::string javascript = base::StringPrintf( |
33 "setTimeout(function() {" | 19 "setTimeout(function() {" |
34 " window.domAutomationController.send('sleep-ok');" | 20 " window.domAutomationController.send('sleep-ok');" |
35 "}, %d)", timeout_msec); | 21 "}, %d)", timeout_msec); |
36 | 22 |
37 std::string result; | 23 std::string result; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // TODO(phoglund): Figure out why this fails every now and then. | 57 // TODO(phoglund): Figure out why this fails every now and then. |
72 // It's not a huge deal if it does though. | 58 // It's not a huge deal if it does though. |
73 LOG(ERROR) << "Failed to sleep."; | 59 LOG(ERROR) << "Failed to sleep."; |
74 } | 60 } |
75 } | 61 } |
76 LOG(ERROR) << "Timed out while waiting for " << javascript << | 62 LOG(ERROR) << "Timed out while waiting for " << javascript << |
77 " to evaluate to " << evaluates_to << "; last result was '" << result << | 63 " to evaluate to " << evaluates_to << "; last result was '" << result << |
78 "'"; | 64 "'"; |
79 return false; | 65 return false; |
80 } | 66 } |
OLD | NEW |