| OLD | NEW |
| 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/browser/ui/views/avatar_menu_button.h" | 5 #include "chrome/browser/ui/views/avatar_menu_button.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 void AvatarMenuButtonTest::CreateTestingProfile() { | 42 void AvatarMenuButtonTest::CreateTestingProfile() { |
| 43 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 43 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 44 EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles()); | 44 EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles()); |
| 45 | 45 |
| 46 base::FilePath path; | 46 base::FilePath path; |
| 47 PathService::Get(chrome::DIR_USER_DATA, &path); | 47 PathService::Get(chrome::DIR_USER_DATA, &path); |
| 48 path = path.AppendASCII("test_profile"); | 48 path = path.AppendASCII("test_profile"); |
| 49 if (!base::PathExists(path)) | 49 if (!base::PathExists(path)) |
| 50 ASSERT_TRUE(file_util::CreateDirectory(path)); | 50 ASSERT_TRUE(base::CreateDirectory(path)); |
| 51 Profile* profile = | 51 Profile* profile = |
| 52 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); | 52 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); |
| 53 profile_manager->RegisterTestingProfile(profile, true, false); | 53 profile_manager->RegisterTestingProfile(profile, true, false); |
| 54 EXPECT_EQ(2u, profile_manager->GetNumberOfProfiles()); | 54 EXPECT_EQ(2u, profile_manager->GetNumberOfProfiles()); |
| 55 } | 55 } |
| 56 | 56 |
| 57 AvatarMenuButton* AvatarMenuButtonTest::GetAvatarMenuButton() { | 57 AvatarMenuButton* AvatarMenuButtonTest::GetAvatarMenuButton() { |
| 58 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 58 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
| 59 browser()->window()); | 59 browser()->window()); |
| 60 return browser_view->frame()->GetAvatarMenuButton(); | 60 return browser_view->frame()->GetAvatarMenuButton(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Verify that clicking again doesn't reshow it. | 95 // Verify that clicking again doesn't reshow it. |
| 96 AvatarMenuButton* button = GetAvatarMenuButton(); | 96 AvatarMenuButton* button = GetAvatarMenuButton(); |
| 97 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( | 97 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( |
| 98 NULL, gfx::Point()); | 98 NULL, gfx::Point()); |
| 99 // Hide the bubble manually. In the browser this would normally happen during | 99 // Hide the bubble manually. In the browser this would normally happen during |
| 100 // the event processing. | 100 // the event processing. |
| 101 AvatarMenuBubbleView::Hide(); | 101 AvatarMenuBubbleView::Hide(); |
| 102 base::MessageLoop::current()->RunUntilIdle(); | 102 base::MessageLoop::current()->RunUntilIdle(); |
| 103 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); | 103 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); |
| 104 } | 104 } |
| OLD | NEW |