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/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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 return net::FilePathToFileURL(GetTestFilePath(dir, file)); | 32 return net::FilePathToFileURL(GetTestFilePath(dir, file)); |
33 } | 33 } |
34 | 34 |
35 void NavigateToURLBlockUntilNavigationsComplete(Shell* window, | 35 void NavigateToURLBlockUntilNavigationsComplete(Shell* window, |
36 const GURL& url, | 36 const GURL& url, |
37 int number_of_navigations) { | 37 int number_of_navigations) { |
38 WaitForLoadStop(window->web_contents()); | 38 WaitForLoadStop(window->web_contents()); |
39 NavigationController* controller = &window->web_contents()->GetController(); | 39 NavigationController* controller = &window->web_contents()->GetController(); |
40 TestNavigationObserver same_tab_observer( | 40 TestNavigationObserver same_tab_observer( |
41 Source<NavigationController>(controller), | 41 Source<NavigationController>(controller), |
42 NULL, | |
43 number_of_navigations); | 42 number_of_navigations); |
44 | 43 |
45 window->LoadURL(url); | 44 window->LoadURL(url); |
46 | 45 |
47 base::RunLoop run_loop; | 46 base::RunLoop run_loop; |
48 same_tab_observer.WaitForObservation( | 47 same_tab_observer.WaitForObservation( |
49 base::Bind(&RunThisRunLoop, base::Unretained(&run_loop)), | 48 base::Bind(&RunThisRunLoop, base::Unretained(&run_loop)), |
50 GetQuitTaskForRunLoop(&run_loop)); | 49 GetQuitTaskForRunLoop(&run_loop)); |
51 } | 50 } |
52 | 51 |
(...skipping 30 matching lines...) Expand all Loading... |
83 } | 82 } |
84 | 83 |
85 void ShellAddedObserver::ShellCreated(Shell* shell) { | 84 void ShellAddedObserver::ShellCreated(Shell* shell) { |
86 DCHECK(!shell_); | 85 DCHECK(!shell_); |
87 shell_ = shell; | 86 shell_ = shell; |
88 if (runner_) | 87 if (runner_) |
89 runner_->QuitClosure().Run(); | 88 runner_->QuitClosure().Run(); |
90 } | 89 } |
91 | 90 |
92 } // namespace content | 91 } // namespace content |
OLD | NEW |