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