Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(681)

Side by Side Diff: chrome/test/base/in_process_browser_test.cc

Issue 16268017: GTTF: convert some tests in chrome to use EmbeddedTestServer patch nr 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready? Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 27 matching lines...) Expand all
38 #include "chrome/test/base/test_launcher_utils.h" 38 #include "chrome/test/base/test_launcher_utils.h"
39 #include "chrome/test/base/testing_browser_process.h" 39 #include "chrome/test/base/testing_browser_process.h"
40 #include "chrome/test/base/ui_test_utils.h" 40 #include "chrome/test/base/ui_test_utils.h"
41 #include "content/public/browser/notification_service.h" 41 #include "content/public/browser/notification_service.h"
42 #include "content/public/browser/notification_types.h" 42 #include "content/public/browser/notification_types.h"
43 #include "content/public/test/browser_test_utils.h" 43 #include "content/public/test/browser_test_utils.h"
44 #include "content/public/test/test_browser_thread.h" 44 #include "content/public/test/test_browser_thread.h"
45 #include "content/public/test/test_launcher.h" 45 #include "content/public/test/test_launcher.h"
46 #include "content/public/test/test_navigation_observer.h" 46 #include "content/public/test/test_navigation_observer.h"
47 #include "net/dns/mock_host_resolver.h" 47 #include "net/dns/mock_host_resolver.h"
48 #include "net/test/embedded_test_server/embedded_test_server.h"
48 #include "net/test/spawned_test_server/spawned_test_server.h" 49 #include "net/test/spawned_test_server/spawned_test_server.h"
49 #include "ui/compositor/compositor_switches.h" 50 #include "ui/compositor/compositor_switches.h"
50 51
51 #if defined(OS_CHROMEOS) 52 #if defined(OS_CHROMEOS)
52 #include "chrome/browser/chromeos/audio/audio_handler.h" 53 #include "chrome/browser/chromeos/audio/audio_handler.h"
53 #elif defined(OS_MACOSX) 54 #elif defined(OS_MACOSX)
54 #include "base/mac/scoped_nsautorelease_pool.h" 55 #include "base/mac/scoped_nsautorelease_pool.h"
55 #endif 56 #endif
56 57
57 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) 58 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
(...skipping 24 matching lines...) Expand all
82 // what it would be if Chrome was running, because it is used to fork renderer 83 // what it would be if Chrome was running, because it is used to fork renderer
83 // processes, on Linux at least (failure to do so will cause a browser_test to 84 // processes, on Linux at least (failure to do so will cause a browser_test to
84 // be run instead of a renderer). 85 // be run instead of a renderer).
85 base::FilePath chrome_path; 86 base::FilePath chrome_path;
86 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); 87 CHECK(PathService::Get(base::FILE_EXE, &chrome_path));
87 chrome_path = chrome_path.DirName(); 88 chrome_path = chrome_path.DirName();
88 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); 89 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath);
89 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); 90 CHECK(PathService::Override(base::FILE_EXE, chrome_path));
90 #endif // defined(OS_MACOSX) 91 #endif // defined(OS_MACOSX)
91 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 92 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
93 base::FilePath src_dir;
94 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir));
95 embedded_test_server()->ServeFilesFromDirectory(
96 src_dir.AppendASCII("chrome/test/data"));
92 } 97 }
93 98
94 InProcessBrowserTest::~InProcessBrowserTest() { 99 InProcessBrowserTest::~InProcessBrowserTest() {
95 } 100 }
96 101
97 void InProcessBrowserTest::SetUp() { 102 void InProcessBrowserTest::SetUp() {
98 // Undo TestingBrowserProcess creation in ChromeTestSuite. 103 // Undo TestingBrowserProcess creation in ChromeTestSuite.
99 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. 104 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this.
100 DCHECK(g_browser_process); 105 DCHECK(g_browser_process);
101 delete g_browser_process; 106 delete g_browser_process;
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // On the Mac, this eventually reaches 397 // On the Mac, this eventually reaches
393 // -[BrowserWindowController windowWillClose:], which will post a deferred 398 // -[BrowserWindowController windowWillClose:], which will post a deferred
394 // -autorelease on itself to ultimately destroy the Browser object. The line 399 // -autorelease on itself to ultimately destroy the Browser object. The line
395 // below is necessary to pump these pending messages to ensure all Browsers 400 // below is necessary to pump these pending messages to ensure all Browsers
396 // get deleted. 401 // get deleted.
397 content::RunAllPendingInMessageLoop(); 402 content::RunAllPendingInMessageLoop();
398 delete autorelease_pool_; 403 delete autorelease_pool_;
399 autorelease_pool_ = NULL; 404 autorelease_pool_ = NULL;
400 #endif 405 #endif
401 } 406 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698