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/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/test_navigation_observer.h" | 15 #include "content/public/test/test_navigation_observer.h" |
16 #include "content/public/test/test_utils.h" | 16 #include "content/public/test/test_utils.h" |
17 #include "content/shell/shell.h" | 17 #include "content/shell/shell.h" |
| 18 #include "content/shell/shell_javascript_dialog_creator.h" |
18 #include "net/base/net_util.h" | 19 #include "net/base/net_util.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 FilePath GetTestFilePath(const char* dir, const char* file) { | 23 FilePath GetTestFilePath(const char* dir, const char* file) { |
23 FilePath path; | 24 FilePath path; |
24 PathService::Get(DIR_TEST_DATA, &path); | 25 PathService::Get(DIR_TEST_DATA, &path); |
25 return path.Append( | 26 return path.Append( |
26 FilePath().AppendASCII(dir).Append(FilePath().AppendASCII(file))); | 27 FilePath().AppendASCII(dir).Append(FilePath().AppendASCII(file))); |
27 } | 28 } |
(...skipping 10 matching lines...) Expand all Loading... |
38 1); | 39 1); |
39 | 40 |
40 window->LoadURL(url); | 41 window->LoadURL(url); |
41 | 42 |
42 base::RunLoop run_loop; | 43 base::RunLoop run_loop; |
43 same_tab_observer.WaitForObservation( | 44 same_tab_observer.WaitForObservation( |
44 base::Bind(&RunThisRunLoop, base::Unretained(&run_loop)), | 45 base::Bind(&RunThisRunLoop, base::Unretained(&run_loop)), |
45 GetQuitTaskForRunLoop(&run_loop)); | 46 GetQuitTaskForRunLoop(&run_loop)); |
46 } | 47 } |
47 | 48 |
| 49 void WaitForAppModalDialog(Shell* window) { |
| 50 ShellJavaScriptDialogCreator* dialog_creator = |
| 51 static_cast<ShellJavaScriptDialogCreator*>( |
| 52 window->GetJavaScriptDialogCreator()); |
| 53 |
| 54 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); |
| 55 dialog_creator->set_dialog_request_callback(runner->QuitClosure()); |
| 56 runner->Run(); |
| 57 } |
| 58 |
48 } // namespace content | 59 } // namespace content |
OLD | NEW |