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/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/test/base/test_switches.h" | 39 #include "chrome/test/base/test_switches.h" |
40 #include "chrome/test/base/testing_browser_process.h" | 40 #include "chrome/test/base/testing_browser_process.h" |
41 #include "chrome/test/base/ui_test_utils.h" | 41 #include "chrome/test/base/ui_test_utils.h" |
42 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
43 #include "content/public/browser/notification_types.h" | 43 #include "content/public/browser/notification_types.h" |
44 #include "content/public/test/browser_test_utils.h" | 44 #include "content/public/test/browser_test_utils.h" |
45 #include "content/public/test/test_browser_thread.h" | 45 #include "content/public/test/test_browser_thread.h" |
46 #include "content/public/test/test_launcher.h" | 46 #include "content/public/test/test_launcher.h" |
47 #include "content/public/test/test_navigation_observer.h" | 47 #include "content/public/test/test_navigation_observer.h" |
48 #include "net/dns/mock_host_resolver.h" | 48 #include "net/dns/mock_host_resolver.h" |
| 49 #include "net/test/embedded_test_server/embedded_test_server.h" |
49 #include "net/test/spawned_test_server/spawned_test_server.h" | 50 #include "net/test/spawned_test_server/spawned_test_server.h" |
50 #include "ui/compositor/compositor_switches.h" | 51 #include "ui/compositor/compositor_switches.h" |
51 | 52 |
52 #if defined(OS_CHROMEOS) | 53 #if defined(OS_CHROMEOS) |
53 #include "chrome/browser/chromeos/audio/audio_handler.h" | 54 #include "chrome/browser/chromeos/audio/audio_handler.h" |
54 #elif defined(OS_MACOSX) | 55 #elif defined(OS_MACOSX) |
55 #include "base/mac/scoped_nsautorelease_pool.h" | 56 #include "base/mac/scoped_nsautorelease_pool.h" |
56 #endif | 57 #endif |
57 | 58 |
58 #if defined(OS_WIN) && defined(USE_AURA) | 59 #if defined(OS_WIN) && defined(USE_AURA) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // what it would be if Chrome was running, because it is used to fork renderer | 93 // what it would be if Chrome was running, because it is used to fork renderer |
93 // processes, on Linux at least (failure to do so will cause a browser_test to | 94 // processes, on Linux at least (failure to do so will cause a browser_test to |
94 // be run instead of a renderer). | 95 // be run instead of a renderer). |
95 base::FilePath chrome_path; | 96 base::FilePath chrome_path; |
96 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 97 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); |
97 chrome_path = chrome_path.DirName(); | 98 chrome_path = chrome_path.DirName(); |
98 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); | 99 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); |
99 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); | 100 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); |
100 #endif // defined(OS_MACOSX) | 101 #endif // defined(OS_MACOSX) |
101 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 102 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 103 base::FilePath src_dir; |
| 104 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); |
| 105 embedded_test_server()->ServeFilesFromDirectory( |
| 106 src_dir.AppendASCII("chrome/test/data")); |
102 } | 107 } |
103 | 108 |
104 InProcessBrowserTest::~InProcessBrowserTest() { | 109 InProcessBrowserTest::~InProcessBrowserTest() { |
105 } | 110 } |
106 | 111 |
107 void InProcessBrowserTest::SetUp() { | 112 void InProcessBrowserTest::SetUp() { |
108 // Undo TestingBrowserProcess creation in ChromeTestSuite. | 113 // Undo TestingBrowserProcess creation in ChromeTestSuite. |
109 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. | 114 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. |
110 DCHECK(g_browser_process); | 115 DCHECK(g_browser_process); |
111 delete g_browser_process; | 116 delete g_browser_process; |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // On the Mac, this eventually reaches | 429 // On the Mac, this eventually reaches |
425 // -[BrowserWindowController windowWillClose:], which will post a deferred | 430 // -[BrowserWindowController windowWillClose:], which will post a deferred |
426 // -autorelease on itself to ultimately destroy the Browser object. The line | 431 // -autorelease on itself to ultimately destroy the Browser object. The line |
427 // below is necessary to pump these pending messages to ensure all Browsers | 432 // below is necessary to pump these pending messages to ensure all Browsers |
428 // get deleted. | 433 // get deleted. |
429 content::RunAllPendingInMessageLoop(); | 434 content::RunAllPendingInMessageLoop(); |
430 delete autorelease_pool_; | 435 delete autorelease_pool_; |
431 autorelease_pool_ = NULL; | 436 autorelease_pool_ = NULL; |
432 #endif | 437 #endif |
433 } | 438 } |
OLD | NEW |