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/path_service.h" | 7 #include "base/path_service.h" |
8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
9 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" | 9 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" |
10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
13 #include "chrome/test/base/testing_browser_process.h" | 13 #include "chrome/test/base/testing_browser_process.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 void CreateTestingProfile() { | 17 void CreateTestingProfile() { |
18 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 18 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
19 EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles()); | 19 EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles()); |
20 | 20 |
21 base::FilePath path; | 21 base::FilePath path; |
22 PathService::Get(chrome::DIR_USER_DATA, &path); | 22 PathService::Get(chrome::DIR_USER_DATA, &path); |
23 path = path.AppendASCII("test_profile"); | 23 path = path.AppendASCII("test_profile"); |
24 if (!file_util::PathExists(path)) | 24 if (!file_util::PathExists(path)) |
25 CHECK(file_util::CreateDirectory(path)); | 25 CHECK(file_util::CreateDirectory(path)); |
26 Profile* profile = | 26 Profile* profile = |
27 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); | 27 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); |
28 profile_manager->RegisterTestingProfile(profile, true); | 28 profile_manager->RegisterTestingProfile(profile, true, false); |
29 | 29 |
30 EXPECT_EQ(2u, profile_manager->GetNumberOfProfiles()); | 30 EXPECT_EQ(2u, profile_manager->GetNumberOfProfiles()); |
31 } | 31 } |
32 | 32 |
33 typedef InProcessBrowserTest AvatarMenuButtonTest; | 33 typedef InProcessBrowserTest AvatarMenuButtonTest; |
34 | 34 |
35 IN_PROC_BROWSER_TEST_F(AvatarMenuButtonTest, HideOnSecondClick) { | 35 IN_PROC_BROWSER_TEST_F(AvatarMenuButtonTest, HideOnSecondClick) { |
36 if (!ProfileManager::IsMultipleProfilesEnabled()) | 36 if (!ProfileManager::IsMultipleProfilesEnabled()) |
37 return; | 37 return; |
38 | 38 |
(...skipping 14 matching lines...) Expand all Loading... |
53 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( | 53 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( |
54 NULL, gfx::Point()); | 54 NULL, gfx::Point()); |
55 // Hide the bubble manually. In the browser this would normally happen during | 55 // Hide the bubble manually. In the browser this would normally happen during |
56 // the event processing. | 56 // the event processing. |
57 AvatarMenuBubbleView::Hide(); | 57 AvatarMenuBubbleView::Hide(); |
58 MessageLoop::current()->RunUntilIdle(); | 58 MessageLoop::current()->RunUntilIdle(); |
59 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); | 59 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); |
60 } | 60 } |
61 | 61 |
62 } // namespace | 62 } // namespace |
OLD | NEW |