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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 117 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
118 | 118 |
119 DISALLOW_COPY_AND_ASSIGN(PermissionRequestObserver); | 119 DISALLOW_COPY_AND_ASSIGN(PermissionRequestObserver); |
120 }; | 120 }; |
121 | 121 |
122 } // namespace | 122 } // namespace |
123 | 123 |
124 WebRtcTestBase::WebRtcTestBase(): detect_errors_in_javascript_(false) { | 124 WebRtcTestBase::WebRtcTestBase(): detect_errors_in_javascript_(false) { |
125 // The handler gets set for each test method, but that's fine since this | 125 // The handler gets set for each test method, but that's fine since this |
126 // set operation is idempotent. | 126 // set operation is idempotent. |
127 logging::SetLogMessageHandler(&JavascriptErrorDetectingLogHandler); | 127 logging::PushLogMessageHandler(&JavascriptErrorDetectingLogHandler); |
128 hit_javascript_errors_.Get() = false; | 128 hit_javascript_errors_.Get() = false; |
129 | 129 |
130 EnablePixelOutput(); | 130 EnablePixelOutput(); |
131 } | 131 } |
132 | 132 |
133 WebRtcTestBase::~WebRtcTestBase() { | 133 WebRtcTestBase::~WebRtcTestBase() { |
| 134 logging::PopLogMessageHandler(); |
134 if (detect_errors_in_javascript_) { | 135 if (detect_errors_in_javascript_) { |
135 EXPECT_FALSE(hit_javascript_errors_.Get()) | 136 EXPECT_FALSE(hit_javascript_errors_.Get()) |
136 << "Encountered javascript errors during test execution (Search " | 137 << "Encountered javascript errors during test execution (Search " |
137 << "for Uncaught or ERROR:CONSOLE in the test output)."; | 138 << "for Uncaught or ERROR:CONSOLE in the test output)."; |
138 } | 139 } |
139 } | 140 } |
140 | 141 |
141 bool WebRtcTestBase::GetUserMediaAndAccept( | 142 bool WebRtcTestBase::GetUserMediaAndAccept( |
142 content::WebContents* tab_contents) const { | 143 content::WebContents* tab_contents) const { |
143 return GetUserMediaWithSpecificConstraintsAndAccept( | 144 return GetUserMediaWithSpecificConstraintsAndAccept( |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 } | 478 } |
478 | 479 |
479 void WebRtcTestBase::GenerateAndCloneCertificate( | 480 void WebRtcTestBase::GenerateAndCloneCertificate( |
480 content::WebContents* tab, const std::string& keygen_algorithm) const { | 481 content::WebContents* tab, const std::string& keygen_algorithm) const { |
481 std::string javascript = base::StringPrintf( | 482 std::string javascript = base::StringPrintf( |
482 "generateAndCloneCertificate(%s)", keygen_algorithm.c_str()); | 483 "generateAndCloneCertificate(%s)", keygen_algorithm.c_str()); |
483 std::string response = ExecuteJavascript(javascript, tab); | 484 std::string response = ExecuteJavascript(javascript, tab); |
484 EXPECT_EQ("ok-generated-and-cloned", response) << "Failed to generate and " | 485 EXPECT_EQ("ok-generated-and-cloned", response) << "Failed to generate and " |
485 "clone certificate: " << response; | 486 "clone certificate: " << response; |
486 } | 487 } |
OLD | NEW |