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/extensions/error_console/error_console.h" | 5 #include "chrome/browser/extensions/error_console/error_console.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 virtual ~ErrorObserver() { | 151 virtual ~ErrorObserver() { |
152 if (error_console_) | 152 if (error_console_) |
153 error_console_->RemoveObserver(this); | 153 error_console_->RemoveObserver(this); |
154 } | 154 } |
155 | 155 |
156 // ErrorConsole::Observer implementation. | 156 // ErrorConsole::Observer implementation. |
157 void OnErrorAdded(const ExtensionError* error) override { | 157 void OnErrorAdded(const ExtensionError* error) override { |
158 ++errors_observed_; | 158 ++errors_observed_; |
159 if (errors_observed_ >= errors_expected_) { | 159 if (errors_observed_ >= errors_expected_) { |
160 if (waiting_) | 160 if (waiting_) |
161 base::MessageLoopForUI::current()->Quit(); | 161 base::MessageLoopForUI::current()->QuitWhenIdle(); |
162 } | 162 } |
163 } | 163 } |
164 | 164 |
165 void OnErrorConsoleDestroyed() override { error_console_ = NULL; } | 165 void OnErrorConsoleDestroyed() override { error_console_ = NULL; } |
166 | 166 |
167 // Spin until the appropriate number of errors have been observed. | 167 // Spin until the appropriate number of errors have been observed. |
168 void WaitForErrors() { | 168 void WaitForErrors() { |
169 if (errors_observed_ < errors_expected_) { | 169 if (errors_observed_ < errors_expected_) { |
170 waiting_ = true; | 170 waiting_ = true; |
171 content::RunMessageLoop(); | 171 content::RunMessageLoop(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 | 580 |
581 const StackTrace& stack_trace = GetStackTraceFromError(errors[0]); | 581 const StackTrace& stack_trace = GetStackTraceFromError(errors[0]); |
582 ASSERT_EQ(1u, stack_trace.size()); | 582 ASSERT_EQ(1u, stack_trace.size()); |
583 CheckStackFrame(stack_trace[0], | 583 CheckStackFrame(stack_trace[0], |
584 script_url, | 584 script_url, |
585 kAnonymousFunction, | 585 kAnonymousFunction, |
586 12u, 20u); | 586 12u, 20u); |
587 } | 587 } |
588 | 588 |
589 } // namespace extensions | 589 } // namespace extensions |
OLD | NEW |