OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_TEST_BROWSER_WITH_TEST_WINDOW_TEST_H_ | 5 #ifndef CHROME_TEST_BROWSER_WITH_TEST_WINDOW_TEST_H_ |
6 #define CHROME_TEST_BROWSER_WITH_TEST_WINDOW_TEST_H_ | 6 #define CHROME_TEST_BROWSER_WITH_TEST_WINDOW_TEST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 protected: | 52 protected: |
53 Browser* browser() const { return browser_.get(); } | 53 Browser* browser() const { return browser_.get(); } |
54 | 54 |
55 TestingProfile* profile() const { return profile_.get(); } | 55 TestingProfile* profile() const { return profile_.get(); } |
56 | 56 |
57 // Adds a tab to |browser| with the given URL and commits the load. | 57 // Adds a tab to |browser| with the given URL and commits the load. |
58 // This is a convenience function. The new tab will be added at index 0. | 58 // This is a convenience function. The new tab will be added at index 0. |
59 void AddTab(Browser* browser, const GURL& url); | 59 void AddTab(Browser* browser, const GURL& url); |
60 | 60 |
61 // Commits the pending load as if we went to a new page (as opposed to back or | 61 // Commits the pending load on the given controller. It will keep the |
62 // forward). | 62 // URL of the pending load. If there is no pending load, this does nothing. |
63 void CommitPendingLoadAsNewNavigation(NavigationController* controller, | 63 void CommitPendingLoad(NavigationController* controller); |
64 const GURL& url); | |
65 | 64 |
66 // Creates a pending navigation on the given navigation controller to the | 65 // Creates a pending navigation on the given navigation controller to the |
67 // given URL with the default parameters and the commits the load with a page | 66 // given URL with the default parameters and the commits the load with a page |
68 // ID one larger than any seen. This emulates what happens on a new | 67 // ID one larger than any seen. This emulates what happens on a new |
69 // navigation. | 68 // navigation. |
70 void NavigateAndCommit(NavigationController* controller, | 69 void NavigateAndCommit(NavigationController* controller, |
71 const GURL& url); | 70 const GURL& url); |
72 | 71 |
73 // Navigates the current tab. This is a wrapper around NavigateAndCommit. | 72 // Navigates the current tab. This is a wrapper around NavigateAndCommit. |
74 void NavigateAndCommitActiveTab(const GURL& url); | 73 void NavigateAndCommitActiveTab(const GURL& url); |
75 | 74 |
76 private: | 75 private: |
77 // We need to create a MessageLoop, otherwise a bunch of things fails. | 76 // We need to create a MessageLoop, otherwise a bunch of things fails. |
78 MessageLoopForUI ui_loop_; | 77 MessageLoopForUI ui_loop_; |
79 | 78 |
80 scoped_ptr<TestingProfile> profile_; | 79 scoped_ptr<TestingProfile> profile_; |
81 scoped_ptr<TestBrowserWindow> window_; | 80 scoped_ptr<TestBrowserWindow> window_; |
82 scoped_ptr<Browser> browser_; | 81 scoped_ptr<Browser> browser_; |
83 | 82 |
84 MockRenderProcessHostFactory rph_factory_; | 83 MockRenderProcessHostFactory rph_factory_; |
85 TestRenderViewHostFactory rvh_factory_; | 84 TestRenderViewHostFactory rvh_factory_; |
86 | 85 |
87 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); | 86 DISALLOW_COPY_AND_ASSIGN(BrowserWithTestWindowTest); |
88 }; | 87 }; |
89 | 88 |
90 #endif // CHROME_TEST_BROWSER_WITH_TEST_WINDOW_TEST_H_ | 89 #endif // CHROME_TEST_BROWSER_WITH_TEST_WINDOW_TEST_H_ |
OLD | NEW |