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

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

Issue 12082123: Rename JavaScriptDialogCreator to JavaScriptDialogManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « content/shell/shell_javascript_dialog_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/content_browser_test_utils.h" 5 #include "content/test/content_browser_test_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_path.h" 8 #include "base/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 "content/public/browser/navigation_controller.h" 11 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/notification_source.h" 12 #include "content/public/browser/notification_source.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/content_paths.h" 14 #include "content/public/common/content_paths.h"
15 #include "content/public/test/browser_test_utils.h" 15 #include "content/public/test/browser_test_utils.h"
16 #include "content/public/test/test_navigation_observer.h" 16 #include "content/public/test/test_navigation_observer.h"
17 #include "content/public/test/test_utils.h" 17 #include "content/public/test/test_utils.h"
18 #include "content/shell/shell.h" 18 #include "content/shell/shell.h"
19 #include "content/shell/shell_javascript_dialog_creator.h" 19 #include "content/shell/shell_javascript_dialog_manager.h"
20 #include "net/base/net_util.h" 20 #include "net/base/net_util.h"
21 21
22 namespace content { 22 namespace content {
23 23
24 FilePath GetTestFilePath(const char* dir, const char* file) { 24 FilePath GetTestFilePath(const char* dir, const char* file) {
25 FilePath path; 25 FilePath path;
26 PathService::Get(DIR_TEST_DATA, &path); 26 PathService::Get(DIR_TEST_DATA, &path);
27 return path.Append( 27 return path.Append(
28 FilePath().AppendASCII(dir).Append(FilePath().AppendASCII(file))); 28 FilePath().AppendASCII(dir).Append(FilePath().AppendASCII(file)));
29 } 29 }
(...skipping 18 matching lines...) Expand all
48 same_tab_observer.WaitForObservation( 48 same_tab_observer.WaitForObservation(
49 base::Bind(&RunThisRunLoop, base::Unretained(&run_loop)), 49 base::Bind(&RunThisRunLoop, base::Unretained(&run_loop)),
50 GetQuitTaskForRunLoop(&run_loop)); 50 GetQuitTaskForRunLoop(&run_loop));
51 } 51 }
52 52
53 void NavigateToURL(Shell* window, const GURL& url) { 53 void NavigateToURL(Shell* window, const GURL& url) {
54 NavigateToURLBlockUntilNavigationsComplete(window, url, 1); 54 NavigateToURLBlockUntilNavigationsComplete(window, url, 1);
55 } 55 }
56 56
57 void WaitForAppModalDialog(Shell* window) { 57 void WaitForAppModalDialog(Shell* window) {
58 ShellJavaScriptDialogCreator* dialog_creator = 58 ShellJavaScriptDialogManager* dialog_manager=
59 static_cast<ShellJavaScriptDialogCreator*>( 59 static_cast<ShellJavaScriptDialogManager*>(
60 window->GetJavaScriptDialogCreator()); 60 window->GetJavaScriptDialogManager());
61 61
62 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); 62 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner();
63 dialog_creator->set_dialog_request_callback(runner->QuitClosure()); 63 dialog_manager->set_dialog_request_callback(runner->QuitClosure());
64 runner->Run(); 64 runner->Run();
65 } 65 }
66 66
67 ShellAddedObserver::ShellAddedObserver() 67 ShellAddedObserver::ShellAddedObserver()
68 : shell_(NULL) { 68 : shell_(NULL) {
69 Shell::SetShellCreatedCallback( 69 Shell::SetShellCreatedCallback(
70 base::Bind(&ShellAddedObserver::ShellCreated, base::Unretained(this))); 70 base::Bind(&ShellAddedObserver::ShellCreated, base::Unretained(this)));
71 } 71 }
72 72
73 ShellAddedObserver::~ShellAddedObserver() { 73 ShellAddedObserver::~ShellAddedObserver() {
74 } 74 }
75 75
76 Shell* ShellAddedObserver::GetShell() { 76 Shell* ShellAddedObserver::GetShell() {
77 if (shell_) 77 if (shell_)
78 return shell_; 78 return shell_;
79 79
80 runner_ = new MessageLoopRunner(); 80 runner_ = new MessageLoopRunner();
81 runner_->Run(); 81 runner_->Run();
82 return shell_; 82 return shell_;
83 } 83 }
84 84
85 void ShellAddedObserver::ShellCreated(Shell* shell) { 85 void ShellAddedObserver::ShellCreated(Shell* shell) {
86 DCHECK(!shell_); 86 DCHECK(!shell_);
87 shell_ = shell; 87 shell_ = shell;
88 if (runner_) 88 if (runner_)
89 runner_->QuitClosure().Run(); 89 runner_->QuitClosure().Run();
90 } 90 }
91 91
92 } // namespace content 92 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/shell_javascript_dialog_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698