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" | 11 #include "base/strings/pattern.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "content/public/browser/navigation_controller.h" | 13 #include "content/public/browser/navigation_controller.h" |
14 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/common/content_paths.h" | 16 #include "content/public/common/content_paths.h" |
17 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
18 #include "content/public/test/test_navigation_observer.h" | 18 #include "content/public/test/test_navigation_observer.h" |
19 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
20 #include "content/shell/browser/shell.h" | 20 #include "content/shell/browser/shell.h" |
Avi (use Gerrit)
2016/06/09 02:11:17
It didn't occur to me that we had this dependency.
ncarter (slow)
2016/06/09 16:24:07
It's legit. Only content_browsertests (and compone
| |
21 #include "content/shell/browser/shell_javascript_dialog_manager.h" | 21 #include "content/shell/browser/shell_javascript_dialog_manager.h" |
22 #include "net/base/filename_util.h" | 22 #include "net/base/filename_util.h" |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 base::FilePath GetTestFilePath(const char* dir, const char* file) { | 26 base::FilePath GetTestFilePath(const char* dir, const char* file) { |
27 base::FilePath path; | 27 base::FilePath path; |
28 PathService::Get(DIR_TEST_DATA, &path); | 28 PathService::Get(DIR_TEST_DATA, &path); |
29 return path.Append(base::FilePath().AppendASCII(dir).Append( | 29 return path.Append(base::FilePath().AppendASCII(dir).Append( |
30 base::FilePath().AppendASCII(file))); | 30 base::FilePath().AppendASCII(file))); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 void WaitForAppModalDialog(Shell* window) { | 97 void WaitForAppModalDialog(Shell* window) { |
98 ShellJavaScriptDialogManager* dialog_manager = | 98 ShellJavaScriptDialogManager* dialog_manager = |
99 static_cast<ShellJavaScriptDialogManager*>( | 99 static_cast<ShellJavaScriptDialogManager*>( |
100 window->GetJavaScriptDialogManager(window->web_contents())); | 100 window->GetJavaScriptDialogManager(window->web_contents())); |
101 | 101 |
102 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); | 102 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); |
103 dialog_manager->set_dialog_request_callback(runner->QuitClosure()); | 103 dialog_manager->set_dialog_request_callback(runner->QuitClosure()); |
104 runner->Run(); | 104 runner->Run(); |
105 } | 105 } |
106 | 106 |
107 RenderFrameHost* ConvertToRenderFrameHost(Shell* shell) { | |
108 return shell->web_contents()->GetMainFrame(); | |
109 } | |
110 | |
107 ShellAddedObserver::ShellAddedObserver() | 111 ShellAddedObserver::ShellAddedObserver() |
108 : shell_(NULL) { | 112 : shell_(NULL) { |
109 Shell::SetShellCreatedCallback( | 113 Shell::SetShellCreatedCallback( |
110 base::Bind(&ShellAddedObserver::ShellCreated, base::Unretained(this))); | 114 base::Bind(&ShellAddedObserver::ShellCreated, base::Unretained(this))); |
111 } | 115 } |
112 | 116 |
113 ShellAddedObserver::~ShellAddedObserver() { | 117 ShellAddedObserver::~ShellAddedObserver() { |
114 } | 118 } |
115 | 119 |
116 Shell* ShellAddedObserver::GetShell() { | 120 Shell* ShellAddedObserver::GetShell() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 | 155 |
152 std::string ascii_message = base::UTF16ToASCII(message); | 156 std::string ascii_message = base::UTF16ToASCII(message); |
153 if (base::MatchPattern(ascii_message, filter_)) { | 157 if (base::MatchPattern(ascii_message, filter_)) { |
154 message_ = ascii_message; | 158 message_ = ascii_message; |
155 message_loop_runner_->Quit(); | 159 message_loop_runner_->Quit(); |
156 } | 160 } |
157 return false; | 161 return false; |
158 } | 162 } |
159 | 163 |
160 } // namespace content | 164 } // namespace content |
OLD | NEW |