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/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 #include "chrome/test/base/test_switches.h" | 42 #include "chrome/test/base/test_switches.h" |
43 #include "chrome/test/base/testing_browser_process.h" | 43 #include "chrome/test/base/testing_browser_process.h" |
44 #include "chrome/test/base/ui_test_utils.h" | 44 #include "chrome/test/base/ui_test_utils.h" |
45 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/notification_types.h" | 46 #include "content/public/browser/notification_types.h" |
47 #include "content/public/test/browser_test_utils.h" | 47 #include "content/public/test/browser_test_utils.h" |
48 #include "content/public/test/test_browser_thread.h" | 48 #include "content/public/test/test_browser_thread.h" |
49 #include "content/public/test/test_launcher.h" | 49 #include "content/public/test/test_launcher.h" |
50 #include "content/public/test/test_navigation_observer.h" | 50 #include "content/public/test/test_navigation_observer.h" |
51 #include "net/dns/mock_host_resolver.h" | 51 #include "net/dns/mock_host_resolver.h" |
| 52 #include "net/test/embedded_test_server/embedded_test_server.h" |
52 #include "net/test/spawned_test_server/spawned_test_server.h" | 53 #include "net/test/spawned_test_server/spawned_test_server.h" |
53 #include "ui/compositor/compositor_switches.h" | 54 #include "ui/compositor/compositor_switches.h" |
54 | 55 |
55 #if defined(OS_CHROMEOS) | 56 #if defined(OS_CHROMEOS) |
56 #include "chrome/browser/chromeos/audio/audio_handler.h" | 57 #include "chrome/browser/chromeos/audio/audio_handler.h" |
57 #elif defined(OS_MACOSX) | 58 #elif defined(OS_MACOSX) |
58 #include "base/mac/scoped_nsautorelease_pool.h" | 59 #include "base/mac/scoped_nsautorelease_pool.h" |
59 #endif | 60 #endif |
60 | 61 |
61 #if defined(OS_WIN) && defined(USE_AURA) | 62 #if defined(OS_WIN) && defined(USE_AURA) |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // what it would be if Chrome was running, because it is used to fork renderer | 129 // what it would be if Chrome was running, because it is used to fork renderer |
129 // processes, on Linux at least (failure to do so will cause a browser_test to | 130 // processes, on Linux at least (failure to do so will cause a browser_test to |
130 // be run instead of a renderer). | 131 // be run instead of a renderer). |
131 base::FilePath chrome_path; | 132 base::FilePath chrome_path; |
132 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 133 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); |
133 chrome_path = chrome_path.DirName(); | 134 chrome_path = chrome_path.DirName(); |
134 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); | 135 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); |
135 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); | 136 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); |
136 #endif // defined(OS_MACOSX) | 137 #endif // defined(OS_MACOSX) |
137 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 138 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 139 base::FilePath src_dir; |
| 140 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); |
| 141 embedded_test_server()->ServeFilesFromDirectory( |
| 142 src_dir.AppendASCII("chrome/test/data")); |
138 } | 143 } |
139 | 144 |
140 InProcessBrowserTest::~InProcessBrowserTest() { | 145 InProcessBrowserTest::~InProcessBrowserTest() { |
141 } | 146 } |
142 | 147 |
143 void InProcessBrowserTest::SetUp() { | 148 void InProcessBrowserTest::SetUp() { |
144 // Undo TestingBrowserProcess creation in ChromeTestSuite. | 149 // Undo TestingBrowserProcess creation in ChromeTestSuite. |
145 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. | 150 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. |
146 DCHECK(g_browser_process); | 151 DCHECK(g_browser_process); |
147 delete g_browser_process; | 152 delete g_browser_process; |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 // On the Mac, this eventually reaches | 481 // On the Mac, this eventually reaches |
477 // -[BrowserWindowController windowWillClose:], which will post a deferred | 482 // -[BrowserWindowController windowWillClose:], which will post a deferred |
478 // -autorelease on itself to ultimately destroy the Browser object. The line | 483 // -autorelease on itself to ultimately destroy the Browser object. The line |
479 // below is necessary to pump these pending messages to ensure all Browsers | 484 // below is necessary to pump these pending messages to ensure all Browsers |
480 // get deleted. | 485 // get deleted. |
481 content::RunAllPendingInMessageLoop(); | 486 content::RunAllPendingInMessageLoop(); |
482 delete autorelease_pool_; | 487 delete autorelease_pool_; |
483 autorelease_pool_ = NULL; | 488 autorelease_pool_ = NULL; |
484 #endif | 489 #endif |
485 } | 490 } |
OLD | NEW |