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

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

Issue 8552004: Use dispatcher to run all pending message. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 26 matching lines...) Expand all
37 #include "content/test/test_browser_thread.h" 37 #include "content/test/test_browser_thread.h"
38 #include "net/base/mock_host_resolver.h" 38 #include "net/base/mock_host_resolver.h"
39 #include "net/test/test_server.h" 39 #include "net/test/test_server.h"
40 40
41 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
42 #include "chrome/browser/chromeos/audio_handler.h" 42 #include "chrome/browser/chromeos/audio_handler.h"
43 #elif defined(OS_MACOSX) 43 #elif defined(OS_MACOSX)
44 #include "base/mac/scoped_nsautorelease_pool.h" 44 #include "base/mac/scoped_nsautorelease_pool.h"
45 #endif 45 #endif
46 46
47 #if defined(USE_AURA)
48 #include "ui/aura/desktop.h"
49 #endif
50
47 // Passed as value of kTestType. 51 // Passed as value of kTestType.
48 static const char kBrowserTestType[] = "browser"; 52 static const char kBrowserTestType[] = "browser";
49 53
50 InProcessBrowserTest::InProcessBrowserTest() 54 InProcessBrowserTest::InProcessBrowserTest()
51 : browser_(NULL), 55 : browser_(NULL),
52 show_window_(false), 56 show_window_(false),
53 dom_automation_enabled_(false), 57 dom_automation_enabled_(false),
54 tab_closeable_state_watcher_enabled_(false) { 58 tab_closeable_state_watcher_enabled_(false) {
55 #if defined(OS_MACOSX) 59 #if defined(OS_MACOSX)
56 // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this. 60 // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this.
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // executed (as opposed to executed inside a message loop) would autorelease 266 // executed (as opposed to executed inside a message loop) would autorelease
263 // objects into a higher-level pool. This pool is not recycled in-sync with 267 // objects into a higher-level pool. This pool is not recycled in-sync with
264 // the message loops' pools and causes problems with code relying on 268 // the message loops' pools and causes problems with code relying on
265 // deallocation via an autorelease pool (such as browser window closure and 269 // deallocation via an autorelease pool (such as browser window closure and
266 // browser shutdown). To avoid this, the following pool is recycled after each 270 // browser shutdown). To avoid this, the following pool is recycled after each
267 // time code is directly executed. 271 // time code is directly executed.
268 base::mac::ScopedNSAutoreleasePool pool; 272 base::mac::ScopedNSAutoreleasePool pool;
269 #endif 273 #endif
270 274
271 // Pump startup related events. 275 // Pump startup related events.
276 #if defined(USE_AURA)
277 MessageLoopForUI::current()->RunAllPendingWithDispatcher(
278 aura::Desktop::GetInstance()->GetDispatcher());
279 #else
272 MessageLoopForUI::current()->RunAllPending(); 280 MessageLoopForUI::current()->RunAllPending();
281 #endif
273 #if defined(OS_MACOSX) 282 #if defined(OS_MACOSX)
274 pool.Recycle(); 283 pool.Recycle();
275 #endif 284 #endif
276 285
277 browser_ = CreateBrowser(ProfileManager::GetDefaultProfile()); 286 browser_ = CreateBrowser(ProfileManager::GetDefaultProfile());
278 #if defined(OS_MACOSX) 287 #if defined(OS_MACOSX)
279 pool.Recycle(); 288 pool.Recycle();
280 #endif 289 #endif
281 290
282 // Pump any pending events that were created as a result of creating a 291 // Pump any pending events that were created as a result of creating a
(...skipping 28 matching lines...) Expand all
311 if (BrowserList::size() == 0) 320 if (BrowserList::size() == 0)
312 return; 321 return;
313 322
314 // Invoke CloseAllBrowsersAndMayExit on a running message loop. 323 // Invoke CloseAllBrowsersAndMayExit on a running message loop.
315 // CloseAllBrowsersAndMayExit exits the message loop after everything has been 324 // CloseAllBrowsersAndMayExit exits the message loop after everything has been
316 // shut down properly. 325 // shut down properly.
317 MessageLoopForUI::current()->PostTask(FROM_HERE, 326 MessageLoopForUI::current()->PostTask(FROM_HERE,
318 base::Bind(&BrowserList::AttemptExit)); 327 base::Bind(&BrowserList::AttemptExit));
319 ui_test_utils::RunMessageLoop(); 328 ui_test_utils::RunMessageLoop();
320 } 329 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698