Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/public/test/content_browser_test_utils.h" | 5 #include "content/public/test/content_browser_test_utils.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/strings/pattern.h" | |
| 12 #include "base/strings/utf_string_conversions.h" | |
| 11 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
| 12 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
| 13 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/common/content_paths.h" | 16 #include "content/public/common/content_paths.h" |
| 15 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
| 16 #include "content/public/test/test_navigation_observer.h" | 18 #include "content/public/test/test_navigation_observer.h" |
| 17 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
| 18 #include "content/shell/browser/shell.h" | 20 #include "content/shell/browser/shell.h" |
| 19 #include "content/shell/browser/shell_javascript_dialog_manager.h" | 21 #include "content/shell/browser/shell_javascript_dialog_manager.h" |
| 20 #include "net/base/filename_util.h" | 22 #include "net/base/filename_util.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 return shell_; | 122 return shell_; |
| 121 } | 123 } |
| 122 | 124 |
| 123 void ShellAddedObserver::ShellCreated(Shell* shell) { | 125 void ShellAddedObserver::ShellCreated(Shell* shell) { |
| 124 DCHECK(!shell_); | 126 DCHECK(!shell_); |
| 125 shell_ = shell; | 127 shell_ = shell; |
| 126 if (runner_.get()) | 128 if (runner_.get()) |
| 127 runner_->QuitClosure().Run(); | 129 runner_->QuitClosure().Run(); |
| 128 } | 130 } |
| 129 | 131 |
| 132 ConsoleObserverDelegate::ConsoleObserverDelegate(WebContents* web_contents, | |
| 133 const std::string& filter) | |
| 134 : web_contents_(web_contents), | |
| 135 filter_(filter), | |
| 136 message_(""), | |
|
Charlie Reis
2016/05/24 22:54:16
nit: I think this is unnecessary, right?
meacer
2016/05/31 23:57:54
Copypasta :)
| |
| 137 message_loop_runner_(new MessageLoopRunner) {} | |
| 138 | |
| 139 ConsoleObserverDelegate::~ConsoleObserverDelegate() {} | |
| 140 | |
| 141 void ConsoleObserverDelegate::Wait() { | |
| 142 message_loop_runner_->Run(); | |
| 143 } | |
| 144 | |
| 145 bool ConsoleObserverDelegate::AddMessageToConsole( | |
| 146 WebContents* source, | |
| 147 int32_t level, | |
| 148 const base::string16& message, | |
| 149 int32_t line_no, | |
| 150 const base::string16& source_id) { | |
| 151 DCHECK(source == web_contents_); | |
| 152 | |
| 153 std::string ascii_message = base::UTF16ToASCII(message); | |
| 154 if (base::MatchPattern(ascii_message, filter_)) { | |
| 155 message_ = ascii_message; | |
| 156 message_loop_runner_->Quit(); | |
| 157 } | |
| 158 return false; | |
| 159 } | |
| 130 | 160 |
| 131 } // namespace content | 161 } // namespace content |
| OLD | NEW |