Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(389)

Side by Side Diff: content/public/test/content_browser_test_utils.cc

Issue 2052633002: Extend the ToRenderFrameHost magic to FrameTreeNode* and Shell* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix induced script bug. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/public/test/content_browser_test_utils.h ('k') | content/test/content_browser_test_utils_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698