| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/stack_trace.h" | 8 #include "base/debug/stack_trace.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/logging_chrome.h" | 27 #include "chrome/common/logging_chrome.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/test/base/test_launcher_utils.h" | 29 #include "chrome/test/base/test_launcher_utils.h" |
| 30 #include "chrome/test/base/testing_browser_process.h" | 30 #include "chrome/test/base/testing_browser_process.h" |
| 31 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
| 32 #include "content/browser/browser_thread.h" | 32 #include "content/browser/browser_thread.h" |
| 33 #include "content/browser/renderer_host/render_process_host.h" | 33 #include "content/browser/renderer_host/render_process_host.h" |
| 34 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
| 35 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/notification_types.h" | 36 #include "content/public/browser/notification_types.h" |
| 36 #include "content/renderer/mock_content_renderer_client.h" | 37 #include "content/renderer/mock_content_renderer_client.h" |
| 37 #include "net/base/mock_host_resolver.h" | 38 #include "net/base/mock_host_resolver.h" |
| 38 #include "net/test/test_server.h" | 39 #include "net/test/test_server.h" |
| 39 | 40 |
| 40 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 41 #include "chrome/browser/chromeos/audio_handler.h" | 42 #include "chrome/browser/chromeos/audio_handler.h" |
| 42 #endif | 43 #endif |
| 43 | 44 |
| 44 // Passed as value of kTestType. | 45 // Passed as value of kTestType. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 225 |
| 225 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { | 226 Browser* InProcessBrowserTest::CreateBrowserForPopup(Profile* profile) { |
| 226 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); | 227 Browser* browser = Browser::CreateForType(Browser::TYPE_POPUP, profile); |
| 227 AddBlankTabAndShow(browser); | 228 AddBlankTabAndShow(browser); |
| 228 return browser; | 229 return browser; |
| 229 } | 230 } |
| 230 | 231 |
| 231 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { | 232 void InProcessBrowserTest::AddBlankTabAndShow(Browser* browser) { |
| 232 ui_test_utils::WindowedNotificationObserver observer( | 233 ui_test_utils::WindowedNotificationObserver observer( |
| 233 content::NOTIFICATION_LOAD_STOP, | 234 content::NOTIFICATION_LOAD_STOP, |
| 234 NotificationService::AllSources()); | 235 content::NotificationService::AllSources()); |
| 235 browser->AddSelectedTabWithURL( | 236 browser->AddSelectedTabWithURL( |
| 236 GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); | 237 GURL(chrome::kAboutBlankURL), content::PAGE_TRANSITION_START_PAGE); |
| 237 observer.Wait(); | 238 observer.Wait(); |
| 238 | 239 |
| 239 browser->window()->Show(); | 240 browser->window()->Show(); |
| 240 } | 241 } |
| 241 | 242 |
| 242 #if defined(OS_POSIX) | 243 #if defined(OS_POSIX) |
| 243 // On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make | 244 // On SIGTERM (sent by the runner on timeouts), dump a stack trace (to make |
| 244 // debugging easier) and also exit with a known error code (so that the test | 245 // debugging easier) and also exit with a known error code (so that the test |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 return; | 293 return; |
| 293 | 294 |
| 294 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 295 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
| 295 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 296 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
| 296 // shut down properly. | 297 // shut down properly. |
| 297 MessageLoopForUI::current()->PostTask( | 298 MessageLoopForUI::current()->PostTask( |
| 298 FROM_HERE, | 299 FROM_HERE, |
| 299 NewRunnableFunction(&BrowserList::AttemptExit)); | 300 NewRunnableFunction(&BrowserList::AttemptExit)); |
| 300 ui_test_utils::RunMessageLoop(); | 301 ui_test_utils::RunMessageLoop(); |
| 301 } | 302 } |
| OLD | NEW |