OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
10 #include "chrome/browser/profiles/profiles_state.h" | 10 #include "chrome/browser/profiles/profiles_state.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/public/test/test_utils.h" | 24 #include "content/public/test/test_utils.h" |
25 #include "ui/views/controls/button/label_button.h" | 25 #include "ui/views/controls/button/label_button.h" |
26 | 26 |
27 class NewAvatarMenuButtonTest : public InProcessBrowserTest { | 27 class NewAvatarMenuButtonTest : public InProcessBrowserTest { |
28 public: | 28 public: |
29 NewAvatarMenuButtonTest(); | 29 NewAvatarMenuButtonTest(); |
30 ~NewAvatarMenuButtonTest() override; | 30 ~NewAvatarMenuButtonTest() override; |
31 | 31 |
32 protected: | 32 protected: |
33 void SetUp() override; | 33 void SetUp() override; |
34 void SetUpCommandLine(CommandLine* command_line) override; | 34 void SetUpCommandLine(base::CommandLine* command_line) override; |
35 void CreateTestingProfile(); | 35 void CreateTestingProfile(); |
36 void StartAvatarMenu(); | 36 void StartAvatarMenu(); |
37 | 37 |
38 private: | 38 private: |
39 DISALLOW_COPY_AND_ASSIGN(NewAvatarMenuButtonTest); | 39 DISALLOW_COPY_AND_ASSIGN(NewAvatarMenuButtonTest); |
40 }; | 40 }; |
41 | 41 |
42 NewAvatarMenuButtonTest::NewAvatarMenuButtonTest() { | 42 NewAvatarMenuButtonTest::NewAvatarMenuButtonTest() { |
43 } | 43 } |
44 | 44 |
45 NewAvatarMenuButtonTest::~NewAvatarMenuButtonTest() { | 45 NewAvatarMenuButtonTest::~NewAvatarMenuButtonTest() { |
46 } | 46 } |
47 | 47 |
48 void NewAvatarMenuButtonTest::SetUp() { | 48 void NewAvatarMenuButtonTest::SetUp() { |
49 InProcessBrowserTest::SetUp(); | 49 InProcessBrowserTest::SetUp(); |
50 DCHECK(switches::IsNewAvatarMenu()); | 50 DCHECK(switches::IsNewAvatarMenu()); |
51 } | 51 } |
52 | 52 |
53 void NewAvatarMenuButtonTest::SetUpCommandLine(CommandLine* command_line) { | 53 void NewAvatarMenuButtonTest::SetUpCommandLine( |
| 54 base::CommandLine* command_line) { |
54 switches::EnableNewAvatarMenuForTesting(command_line); | 55 switches::EnableNewAvatarMenuForTesting(command_line); |
55 } | 56 } |
56 | 57 |
57 void NewAvatarMenuButtonTest::CreateTestingProfile() { | 58 void NewAvatarMenuButtonTest::CreateTestingProfile() { |
58 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 59 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
59 EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles()); | 60 EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles()); |
60 | 61 |
61 // Sign in the default profile | 62 // Sign in the default profile |
62 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 63 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
63 cache.SetUserNameOfProfileAtIndex(0, base::UTF8ToUTF16("user_name")); | 64 cache.SetUserNameOfProfileAtIndex(0, base::UTF8ToUTF16("user_name")); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 window_close_observer.Wait(); // Rely on test timeout for failure indication. | 132 window_close_observer.Wait(); // Rely on test timeout for failure indication. |
132 EXPECT_TRUE(browser_list->empty()); | 133 EXPECT_TRUE(browser_list->empty()); |
133 | 134 |
134 // If the User Manager hasn't shown yet, wait for it to show up. | 135 // If the User Manager hasn't shown yet, wait for it to show up. |
135 if (!UserManager::IsShowing()) | 136 if (!UserManager::IsShowing()) |
136 base::MessageLoop::current()->RunUntilIdle(); | 137 base::MessageLoop::current()->RunUntilIdle(); |
137 | 138 |
138 // We need to hide the User Manager or else the process can't die. | 139 // We need to hide the User Manager or else the process can't die. |
139 UserManager::Hide(); | 140 UserManager::Hide(); |
140 } | 141 } |
OLD | NEW |