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

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

Issue 1211213003: mac: Swizzle out +[NSBundle mainBundle] for in process browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove blank line. Created 5 years, 5 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
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/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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/public/browser/notification_service.h" 47 #include "content/public/browser/notification_service.h"
48 #include "content/public/browser/notification_types.h" 48 #include "content/public/browser/notification_types.h"
49 #include "content/public/test/browser_test_utils.h" 49 #include "content/public/test/browser_test_utils.h"
50 #include "content/public/test/test_launcher.h" 50 #include "content/public/test/test_launcher.h"
51 #include "content/public/test/test_navigation_observer.h" 51 #include "content/public/test/test_navigation_observer.h"
52 #include "net/test/embedded_test_server/embedded_test_server.h" 52 #include "net/test/embedded_test_server/embedded_test_server.h"
53 #include "net/test/spawned_test_server/spawned_test_server.h" 53 #include "net/test/spawned_test_server/spawned_test_server.h"
54 54
55 #if defined(OS_MACOSX) 55 #if defined(OS_MACOSX)
56 #include "base/mac/scoped_nsautorelease_pool.h" 56 #include "base/mac/scoped_nsautorelease_pool.h"
57 #include "chrome/test/base/scoped_bundle_swizzler_mac.h"
57 #endif 58 #endif
58 59
59 #if defined(OS_WIN) 60 #if defined(OS_WIN)
60 #include "base/win/scoped_com_initializer.h" 61 #include "base/win/scoped_com_initializer.h"
61 #include "base/win/windows_version.h" 62 #include "base/win/windows_version.h"
62 #include "ui/base/win/atl_module.h" 63 #include "ui/base/win/atl_module.h"
63 #include "win8/test/metro_registration_helper.h" 64 #include "win8/test/metro_registration_helper.h"
64 #include "win8/test/test_registrar_constants.h" 65 #include "win8/test/test_registrar_constants.h"
65 #endif 66 #endif
66 67
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); 180 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
180 base::FilePath src_dir; 181 base::FilePath src_dir;
181 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); 182 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir));
182 base::FilePath test_data_dir = src_dir.AppendASCII("chrome/test/data"); 183 base::FilePath test_data_dir = src_dir.AppendASCII("chrome/test/data");
183 embedded_test_server()->ServeFilesFromDirectory(test_data_dir); 184 embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
184 185
185 // chrome::DIR_TEST_DATA isn't going to be setup until after we call 186 // chrome::DIR_TEST_DATA isn't going to be setup until after we call
186 // ContentMain. However that is after tests' constructors or SetUp methods, 187 // ContentMain. However that is after tests' constructors or SetUp methods,
187 // which sometimes need it. So just override it. 188 // which sometimes need it. So just override it.
188 CHECK(PathService::Override(chrome::DIR_TEST_DATA, test_data_dir)); 189 CHECK(PathService::Override(chrome::DIR_TEST_DATA, test_data_dir));
190
191 #if defined(OS_MACOSX)
192 bundle_swizzler_.reset(new ScopedBundleSwizzlerMac);
193 #endif
189 } 194 }
190 195
191 InProcessBrowserTest::~InProcessBrowserTest() { 196 InProcessBrowserTest::~InProcessBrowserTest() {
192 } 197 }
193 198
194 void InProcessBrowserTest::SetUp() { 199 void InProcessBrowserTest::SetUp() {
195 // Browser tests will create their own g_browser_process later. 200 // Browser tests will create their own g_browser_process later.
196 DCHECK(!g_browser_process); 201 DCHECK(!g_browser_process);
197 202
198 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 203 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // On the Mac, this eventually reaches 596 // On the Mac, this eventually reaches
592 // -[BrowserWindowController windowWillClose:], which will post a deferred 597 // -[BrowserWindowController windowWillClose:], which will post a deferred
593 // -autorelease on itself to ultimately destroy the Browser object. The line 598 // -autorelease on itself to ultimately destroy the Browser object. The line
594 // below is necessary to pump these pending messages to ensure all Browsers 599 // below is necessary to pump these pending messages to ensure all Browsers
595 // get deleted. 600 // get deleted.
596 content::RunAllPendingInMessageLoop(); 601 content::RunAllPendingInMessageLoop();
597 delete autorelease_pool_; 602 delete autorelease_pool_;
598 autorelease_pool_ = NULL; 603 autorelease_pool_ = NULL;
599 #endif 604 #endif
600 } 605 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698