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 "content/browser/frame_host/render_frame_host_impl.h" | |
| 11 #include "content/public/browser/navigation_controller.h" | 12 #include "content/public/browser/navigation_controller.h" |
| 12 #include "content/public/browser/notification_source.h" | 13 #include "content/public/browser/notification_source.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 #include "content/public/common/content_paths.h" | 15 #include "content/public/common/content_paths.h" |
| 15 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
| 16 #include "content/public/test/test_navigation_observer.h" | 17 #include "content/public/test/test_navigation_observer.h" |
| 17 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 18 #include "content/shell/browser/shell.h" | 19 #include "content/shell/browser/shell.h" |
| 19 #include "content/shell/browser/shell_javascript_dialog_manager.h" | 20 #include "content/shell/browser/shell_javascript_dialog_manager.h" |
| 21 #include "content/test/test_frame_navigation_observer.h" | |
| 20 #include "net/base/filename_util.h" | 22 #include "net/base/filename_util.h" |
| 21 | 23 |
| 22 namespace content { | 24 namespace content { |
| 23 | 25 |
| 24 base::FilePath GetTestFilePath(const char* dir, const char* file) { | 26 base::FilePath GetTestFilePath(const char* dir, const char* file) { |
| 25 base::FilePath path; | 27 base::FilePath path; |
| 26 PathService::Get(DIR_TEST_DATA, &path); | 28 PathService::Get(DIR_TEST_DATA, &path); |
| 27 return path.Append(base::FilePath().AppendASCII(dir).Append( | 29 return path.Append(base::FilePath().AppendASCII(dir).Append( |
| 28 base::FilePath().AppendASCII(file))); | 30 base::FilePath().AppendASCII(file))); |
| 29 } | 31 } |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 49 TestNavigationObserver same_tab_observer(window->web_contents(), 1); | 51 TestNavigationObserver same_tab_observer(window->web_contents(), 1); |
| 50 | 52 |
| 51 window->LoadDataWithBaseURL(url, data, base_url); | 53 window->LoadDataWithBaseURL(url, data, base_url); |
| 52 same_tab_observer.Wait(); | 54 same_tab_observer.Wait(); |
| 53 } | 55 } |
| 54 | 56 |
| 55 void NavigateToURL(Shell* window, const GURL& url) { | 57 void NavigateToURL(Shell* window, const GURL& url) { |
| 56 NavigateToURLBlockUntilNavigationsComplete(window, url, 1); | 58 NavigateToURLBlockUntilNavigationsComplete(window, url, 1); |
| 57 } | 59 } |
| 58 | 60 |
| 61 void NavigateFrameToURL(RenderFrameHostImpl* rfh, const GURL& url) { | |
| 62 TestFrameNavigationObserver observer(rfh); | |
| 63 rfh->NavigateToURL(url); | |
|
Charlie Reis
2014/04/24 20:37:50
Hmm, I'm not sure we want to use RFH::NavigateToUR
nasko
2014/04/24 22:31:12
Done.
| |
| 64 observer.Wait(); | |
| 65 } | |
| 66 | |
| 59 void WaitForAppModalDialog(Shell* window) { | 67 void WaitForAppModalDialog(Shell* window) { |
| 60 ShellJavaScriptDialogManager* dialog_manager= | 68 ShellJavaScriptDialogManager* dialog_manager= |
| 61 static_cast<ShellJavaScriptDialogManager*>( | 69 static_cast<ShellJavaScriptDialogManager*>( |
| 62 window->GetJavaScriptDialogManager()); | 70 window->GetJavaScriptDialogManager()); |
| 63 | 71 |
| 64 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); | 72 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); |
| 65 dialog_manager->set_dialog_request_callback(runner->QuitClosure()); | 73 dialog_manager->set_dialog_request_callback(runner->QuitClosure()); |
| 66 runner->Run(); | 74 runner->Run(); |
| 67 } | 75 } |
| 68 | 76 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 85 } | 93 } |
| 86 | 94 |
| 87 void ShellAddedObserver::ShellCreated(Shell* shell) { | 95 void ShellAddedObserver::ShellCreated(Shell* shell) { |
| 88 DCHECK(!shell_); | 96 DCHECK(!shell_); |
| 89 shell_ = shell; | 97 shell_ = shell; |
| 90 if (runner_.get()) | 98 if (runner_.get()) |
| 91 runner_->QuitClosure().Run(); | 99 runner_->QuitClosure().Run(); |
| 92 } | 100 } |
| 93 | 101 |
| 94 } // namespace content | 102 } // namespace content |
| OLD | NEW |