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

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

Issue 8571026: Fix fullscreen mode on aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-try -b win_aura,linux_aura,win,linux_chromeos 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
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 30 matching lines...) Expand all
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) 47 #if defined(USE_AURA)
48 #include "ui/aura/desktop.h" 48 #include "ui/aura/desktop.h"
49 #endif 49 #endif
50 50
51 namespace {
52
51 // Passed as value of kTestType. 53 // Passed as value of kTestType.
52 static const char kBrowserTestType[] = "browser"; 54 const char kBrowserTestType[] = "browser";
55
56 void RunAllPendingInMessageLoop() {
57 #if defined(USE_AURA)
58 MessageLoopForUI::current()->RunAllPendingWithDispatcher(
59 aura::Desktop::GetInstance()->GetDispatcher());
60 #else
61 MessageLoopForUI::current()->RunAllPending();
62 #endif
63 }
64
65 } // namespace
53 66
54 InProcessBrowserTest::InProcessBrowserTest() 67 InProcessBrowserTest::InProcessBrowserTest()
55 : browser_(NULL), 68 : browser_(NULL),
56 show_window_(false), 69 show_window_(false),
57 dom_automation_enabled_(false), 70 dom_automation_enabled_(false),
58 tab_closeable_state_watcher_enabled_(false) { 71 tab_closeable_state_watcher_enabled_(false) {
59 #if defined(OS_MACOSX) 72 #if defined(OS_MACOSX)
60 // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this. 73 // TODO(phajdan.jr): Make browser_tests self-contained on Mac, remove this.
61 // Before we run the browser, we have to hack the path to the exe to match 74 // Before we run the browser, we have to hack the path to the exe to match
62 // what it would be if Chrome was running, because it is used to fork renderer 75 // what it would be if Chrome was running, because it is used to fork renderer
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // executed (as opposed to executed inside a message loop) would autorelease 279 // executed (as opposed to executed inside a message loop) would autorelease
267 // objects into a higher-level pool. This pool is not recycled in-sync with 280 // objects into a higher-level pool. This pool is not recycled in-sync with
268 // the message loops' pools and causes problems with code relying on 281 // the message loops' pools and causes problems with code relying on
269 // deallocation via an autorelease pool (such as browser window closure and 282 // deallocation via an autorelease pool (such as browser window closure and
270 // browser shutdown). To avoid this, the following pool is recycled after each 283 // browser shutdown). To avoid this, the following pool is recycled after each
271 // time code is directly executed. 284 // time code is directly executed.
272 base::mac::ScopedNSAutoreleasePool pool; 285 base::mac::ScopedNSAutoreleasePool pool;
273 #endif 286 #endif
274 287
275 // Pump startup related events. 288 // Pump startup related events.
276 #if defined(USE_AURA) 289 RunAllPendingInMessageLoop();
277 MessageLoopForUI::current()->RunAllPendingWithDispatcher( 290
278 aura::Desktop::GetInstance()->GetDispatcher());
279 #else
280 MessageLoopForUI::current()->RunAllPending();
281 #endif
282 #if defined(OS_MACOSX) 291 #if defined(OS_MACOSX)
283 pool.Recycle(); 292 pool.Recycle();
284 #endif 293 #endif
285 294
286 browser_ = CreateBrowser(ProfileManager::GetDefaultProfile()); 295 browser_ = CreateBrowser(ProfileManager::GetDefaultProfile());
287 #if defined(OS_MACOSX) 296 #if defined(OS_MACOSX)
288 pool.Recycle(); 297 pool.Recycle();
289 #endif 298 #endif
290 299
291 // Pump any pending events that were created as a result of creating a 300 // Pump any pending events that were created as a result of creating a
292 // browser. 301 // browser.
293 MessageLoopForUI::current()->RunAllPending(); 302 RunAllPendingInMessageLoop();
294 303
295 SetUpOnMainThread(); 304 SetUpOnMainThread();
296 #if defined(OS_MACOSX) 305 #if defined(OS_MACOSX)
297 pool.Recycle(); 306 pool.Recycle();
298 #endif 307 #endif
299 308
300 if (!HasFatalFailure()) 309 if (!HasFatalFailure())
301 RunTestOnMainThread(); 310 RunTestOnMainThread();
302 #if defined(OS_MACOSX) 311 #if defined(OS_MACOSX)
303 pool.Recycle(); 312 pool.Recycle();
(...skipping 16 matching lines...) Expand all
320 if (BrowserList::size() == 0) 329 if (BrowserList::size() == 0)
321 return; 330 return;
322 331
323 // Invoke CloseAllBrowsersAndMayExit on a running message loop. 332 // Invoke CloseAllBrowsersAndMayExit on a running message loop.
324 // CloseAllBrowsersAndMayExit exits the message loop after everything has been 333 // CloseAllBrowsersAndMayExit exits the message loop after everything has been
325 // shut down properly. 334 // shut down properly.
326 MessageLoopForUI::current()->PostTask(FROM_HERE, 335 MessageLoopForUI::current()->PostTask(FROM_HERE,
327 base::Bind(&BrowserList::AttemptExit)); 336 base::Bind(&BrowserList::AttemptExit));
328 ui_test_utils::RunMessageLoop(); 337 ui_test_utils::RunMessageLoop();
329 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698