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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 browser->tab_strip_model()->GetActiveWebContents(); | 139 browser->tab_strip_model()->GetActiveWebContents(); |
140 if (!web_contents) | 140 if (!web_contents) |
141 return false; | 141 return false; |
142 NavigationEntry* last_entry = web_contents->GetController().GetActiveEntry(); | 142 NavigationEntry* last_entry = web_contents->GetController().GetActiveEntry(); |
143 if (!last_entry) | 143 if (!last_entry) |
144 return false; | 144 return false; |
145 title->assign(last_entry->GetTitleForDisplay(std::string())); | 145 title->assign(last_entry->GetTitleForDisplay(std::string())); |
146 return true; | 146 return true; |
147 } | 147 } |
148 | 148 |
149 Browser* OpenURLOffTheRecord(Profile* profile, const GURL& url) { | |
150 chrome::HostDesktopType active_desktop = chrome::GetActiveDesktop(); | |
151 chrome::OpenURLOffTheRecord(profile, url, active_desktop); | |
152 Browser* browser = chrome::FindTabbedBrowser( | |
153 profile->GetOffTheRecordProfile(), false, active_desktop); | |
154 content::TestNavigationObserver observer( | |
155 browser->tab_strip_model()->GetActiveWebContents()); | |
156 observer.Wait(); | |
157 return browser; | |
158 } | |
159 | |
160 void NavigateToURL(chrome::NavigateParams* params) { | 149 void NavigateToURL(chrome::NavigateParams* params) { |
161 chrome::Navigate(params); | 150 chrome::Navigate(params); |
162 content::WaitForLoadStop(params->target_contents); | 151 content::WaitForLoadStop(params->target_contents); |
163 } | 152 } |
164 | 153 |
165 | 154 |
166 void NavigateToURLWithPost(Browser* browser, const GURL& url) { | 155 void NavigateToURLWithPost(Browser* browser, const GURL& url) { |
167 chrome::NavigateParams params(browser, url, | 156 chrome::NavigateParams params(browser, url, |
168 ui::PAGE_TRANSITION_FORM_SUBMIT); | 157 ui::PAGE_TRANSITION_FORM_SUBMIT); |
169 params.uses_post = true; | 158 params.uses_post = true; |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 new content::MessageLoopRunner; | 544 new content::MessageLoopRunner; |
556 WaitHistoryLoadedObserver observer(runner.get()); | 545 WaitHistoryLoadedObserver observer(runner.get()); |
557 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> | 546 ScopedObserver<history::HistoryService, history::HistoryServiceObserver> |
558 scoped_observer(&observer); | 547 scoped_observer(&observer); |
559 scoped_observer.Add(history_service); | 548 scoped_observer.Add(history_service); |
560 runner->Run(); | 549 runner->Run(); |
561 } | 550 } |
562 } | 551 } |
563 | 552 |
564 } // namespace ui_test_utils | 553 } // namespace ui_test_utils |
OLD | NEW |