| OLD | NEW |
| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/run_loop.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 10 #import "chrome/browser/app_controller_mac.h" | 11 #import "chrome/browser/app_controller_mac.h" |
| 11 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 12 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/test/base/testing_browser_process.h" |
| 17 #include "chrome/test/base/testing_profile.h" |
| 15 #include "chrome/test/base/testing_profile_manager.h" | 18 #include "chrome/test/base/testing_profile_manager.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "content/public/test/test_browser_thread_bundle.h" |
| 17 #include "testing/platform_test.h" | 21 #include "testing/platform_test.h" |
| 18 | 22 |
| 19 class AppControllerTest : public PlatformTest { | 23 class AppControllerTest : public PlatformTest { |
| 20 protected: | 24 protected: |
| 21 AppControllerTest() | 25 AppControllerTest() {} |
| 22 : ui_thread_(content::BrowserThread::UI, &message_loop_), | |
| 23 db_thread_(content::BrowserThread::DB, &message_loop_), | |
| 24 file_thread_(content::BrowserThread::FILE, &message_loop_) { | |
| 25 } | |
| 26 | 26 |
| 27 virtual void TearDown() { | 27 virtual void TearDown() { |
| 28 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); | 28 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); |
| 29 message_loop_.RunUntilIdle(); | 29 base::RunLoop().RunUntilIdle(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 base::MessageLoopForUI message_loop_; | 32 content::TestBrowserThreadBundle thread_bundle_; |
| 33 content::TestBrowserThread ui_thread_; | |
| 34 content::TestBrowserThread db_thread_; | |
| 35 content::TestBrowserThread file_thread_; | |
| 36 }; | 33 }; |
| 37 | 34 |
| 38 TEST_F(AppControllerTest, DockMenu) { | 35 TEST_F(AppControllerTest, DockMenu) { |
| 39 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); | 36 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); |
| 40 NSMenu* menu = [ac applicationDockMenu:NSApp]; | 37 NSMenu* menu = [ac applicationDockMenu:NSApp]; |
| 41 NSMenuItem* item; | 38 NSMenuItem* item; |
| 42 | 39 |
| 43 EXPECT_TRUE(menu); | 40 EXPECT_TRUE(menu); |
| 44 EXPECT_NE(-1, [menu indexOfItemWithTag:IDC_NEW_WINDOW]); | 41 EXPECT_NE(-1, [menu indexOfItemWithTag:IDC_NEW_WINDOW]); |
| 45 EXPECT_NE(-1, [menu indexOfItemWithTag:IDC_NEW_INCOGNITO_WINDOW]); | 42 EXPECT_NE(-1, [menu indexOfItemWithTag:IDC_NEW_INCOGNITO_WINDOW]); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 64 PrefService* local_state = g_browser_process->local_state(); | 61 PrefService* local_state = g_browser_process->local_state(); |
| 65 local_state->SetString(prefs::kProfileLastUsed, | 62 local_state->SetString(prefs::kProfileLastUsed, |
| 66 dest_path1.BaseName().MaybeAsASCII()); | 63 dest_path1.BaseName().MaybeAsASCII()); |
| 67 | 64 |
| 68 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); | 65 base::scoped_nsobject<AppController> ac([[AppController alloc] init]); |
| 69 | 66 |
| 70 // Delete the active profile. | 67 // Delete the active profile. |
| 71 manager.profile_manager()->ScheduleProfileForDeletion( | 68 manager.profile_manager()->ScheduleProfileForDeletion( |
| 72 dest_path1, ProfileManager::CreateCallback()); | 69 dest_path1, ProfileManager::CreateCallback()); |
| 73 | 70 |
| 74 message_loop_.RunUntilIdle(); | 71 base::RunLoop().RunUntilIdle(); |
| 75 | 72 |
| 76 EXPECT_EQ(dest_path2, [ac lastProfile]->GetPath()); | 73 EXPECT_EQ(dest_path2, [ac lastProfile]->GetPath()); |
| 77 } | 74 } |
| OLD | NEW |