| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
| 17 #include "base/location.h" | 17 #include "base/location.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/message_loop/message_loop.h" | 20 #include "base/message_loop/message_loop.h" |
| 21 #include "base/run_loop.h" |
| 21 #include "base/single_thread_task_runner.h" | 22 #include "base/single_thread_task_runner.h" |
| 22 #include "base/strings/string_split.h" | 23 #include "base/strings/string_split.h" |
| 23 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 24 #include "base/sys_info.h" | 25 #include "base/sys_info.h" |
| 25 #include "base/threading/sequenced_worker_pool.h" | 26 #include "base/threading/sequenced_worker_pool.h" |
| 26 #include "base/threading/thread_task_runner_handle.h" | 27 #include "base/threading/thread_task_runner_handle.h" |
| 27 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 28 #include "chrome/app/chrome_command_ids.h" | 29 #include "chrome/app/chrome_command_ids.h" |
| 29 #include "chrome/browser/chrome_content_browser_client.h" | 30 #include "chrome/browser/chrome_content_browser_client.h" |
| 30 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 // Cycle both the MessageLoop and the Cocoa runloop twice to flush out any | 914 // Cycle both the MessageLoop and the Cocoa runloop twice to flush out any |
| 914 // Chrome work that generates Cocoa work. Do this twice since there are two | 915 // Chrome work that generates Cocoa work. Do this twice since there are two |
| 915 // Browsers that must be closed. | 916 // Browsers that must be closed. |
| 916 CycleRunLoops(); | 917 CycleRunLoops(); |
| 917 CycleRunLoops(); | 918 CycleRunLoops(); |
| 918 | 919 |
| 919 // Run the application event loop to completion, which will cycle the | 920 // Run the application event loop to completion, which will cycle the |
| 920 // native MessagePump on all platforms. | 921 // native MessagePump on all platforms. |
| 921 base::ThreadTaskRunnerHandle::Get()->PostTask( | 922 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 922 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 923 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 923 base::MessageLoop::current()->Run(); | 924 base::RunLoop().Run(); |
| 924 | 925 |
| 925 // Take care of any remaining Cocoa work. | 926 // Take care of any remaining Cocoa work. |
| 926 CycleRunLoops(); | 927 CycleRunLoops(); |
| 927 | 928 |
| 928 // At this point, quit should be for real now. | 929 // At this point, quit should be for real now. |
| 929 ASSERT_EQ(0u, chrome::GetTotalBrowserCount()); | 930 ASSERT_EQ(0u, chrome::GetTotalBrowserCount()); |
| 930 } | 931 } |
| 931 | 932 |
| 932 // A helper function that cycles the MessageLoop, and on Mac, the Cocoa run | 933 // A helper function that cycles the MessageLoop, and on Mac, the Cocoa run |
| 933 // loop. It also drains the NSAutoreleasePool. | 934 // loop. It also drains the NSAutoreleasePool. |
| (...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2843 Browser* browser = new Browser(params); | 2844 Browser* browser = new Browser(params); |
| 2844 gfx::Rect bounds = browser->window()->GetBounds(); | 2845 gfx::Rect bounds = browser->window()->GetBounds(); |
| 2845 | 2846 |
| 2846 // Should be EXPECT_EQ, but this width is inconsistent across platforms. | 2847 // Should be EXPECT_EQ, but this width is inconsistent across platforms. |
| 2847 // See https://crbug.com/567925. | 2848 // See https://crbug.com/567925. |
| 2848 EXPECT_GE(bounds.width(), 100); | 2849 EXPECT_GE(bounds.width(), 100); |
| 2849 EXPECT_EQ(122, bounds.height()); | 2850 EXPECT_EQ(122, bounds.height()); |
| 2850 browser->window()->Close(); | 2851 browser->window()->Close(); |
| 2851 } | 2852 } |
| 2852 } | 2853 } |
| OLD | NEW |