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

Side by Side Diff: chrome/browser/ui/views/profiles/avatar_menu_button_browsertest.cc

Issue 1038423004: Reland of: Change default code flag to NewAvatarMenu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unneeded code from ProfileInfoCacheTest Created 5 years, 8 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/profiles/avatar_menu_button.h" 5 #include "chrome/browser/ui/views/profiles/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"
11 #include "chrome/browser/profiles/profiles_state.h" 11 #include "chrome/browser/profiles/profiles_state.h"
12 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
13 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
14 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h" 14 #include "chrome/browser/ui/views/profiles/avatar_menu_bubble_view.h"
15 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
18 #include "chrome/test/base/test_switches.h" 18 #include "chrome/test/base/test_switches.h"
19 #include "chrome/test/base/testing_browser_process.h" 19 #include "chrome/test/base/testing_browser_process.h"
20 #include "components/signin/core/common/profile_management_switches.h"
20 21
21 class AvatarMenuButtonTest : public InProcessBrowserTest { 22 class AvatarMenuButtonTest : public InProcessBrowserTest {
22 public: 23 public:
23 AvatarMenuButtonTest(); 24 AvatarMenuButtonTest();
24 ~AvatarMenuButtonTest() override; 25 ~AvatarMenuButtonTest() override;
25 26
26 protected: 27 protected:
28 void SetUpCommandLine(base::CommandLine* command_line) override;
27 void CreateTestingProfile(); 29 void CreateTestingProfile();
28 AvatarMenuButton* GetAvatarMenuButton(); 30 AvatarMenuButton* GetAvatarMenuButton();
29 void StartAvatarMenu(); 31 void StartAvatarMenu();
30 32
31 private: 33 private:
32 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButtonTest); 34 DISALLOW_COPY_AND_ASSIGN(AvatarMenuButtonTest);
33 }; 35 };
34 36
35 AvatarMenuButtonTest::AvatarMenuButtonTest() { 37 AvatarMenuButtonTest::AvatarMenuButtonTest() {
36 } 38 }
37 39
38 AvatarMenuButtonTest::~AvatarMenuButtonTest() { 40 AvatarMenuButtonTest::~AvatarMenuButtonTest() {
39 } 41 }
40 42
43 void AvatarMenuButtonTest::SetUpCommandLine(base::CommandLine* command_line) {
44 switches::DisableNewAvatarMenuForTesting(command_line);
45 }
46
41 void AvatarMenuButtonTest::CreateTestingProfile() { 47 void AvatarMenuButtonTest::CreateTestingProfile() {
42 ProfileManager* profile_manager = g_browser_process->profile_manager(); 48 ProfileManager* profile_manager = g_browser_process->profile_manager();
43 EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles()); 49 EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles());
44 50
45 base::FilePath path; 51 base::FilePath path;
46 PathService::Get(chrome::DIR_USER_DATA, &path); 52 PathService::Get(chrome::DIR_USER_DATA, &path);
47 path = path.AppendASCII("test_profile"); 53 path = path.AppendASCII("test_profile");
48 if (!base::PathExists(path)) 54 if (!base::PathExists(path))
49 ASSERT_TRUE(base::CreateDirectory(path)); 55 ASSERT_TRUE(base::CreateDirectory(path));
50 Profile* profile = 56 Profile* profile =
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // Verify that clicking again doesn't reshow it. 105 // Verify that clicking again doesn't reshow it.
100 AvatarMenuButton* button = GetAvatarMenuButton(); 106 AvatarMenuButton* button = GetAvatarMenuButton();
101 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( 107 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked(
102 NULL, gfx::Point()); 108 NULL, gfx::Point());
103 // Hide the bubble manually. In the browser this would normally happen during 109 // Hide the bubble manually. In the browser this would normally happen during
104 // the event processing. 110 // the event processing.
105 AvatarMenuBubbleView::Hide(); 111 AvatarMenuBubbleView::Hide();
106 base::MessageLoop::current()->RunUntilIdle(); 112 base::MessageLoop::current()->RunUntilIdle();
107 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); 113 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing());
108 } 114 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698