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 "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 }; | 46 }; |
47 | 47 |
48 ProfileChooserViewBrowserTest::ProfileChooserViewBrowserTest() { | 48 ProfileChooserViewBrowserTest::ProfileChooserViewBrowserTest() { |
49 } | 49 } |
50 | 50 |
51 ProfileChooserViewBrowserTest::~ProfileChooserViewBrowserTest() { | 51 ProfileChooserViewBrowserTest::~ProfileChooserViewBrowserTest() { |
52 } | 52 } |
53 | 53 |
54 void ProfileChooserViewBrowserTest::SetUp() { | 54 void ProfileChooserViewBrowserTest::SetUp() { |
55 InProcessBrowserTest::SetUp(); | 55 InProcessBrowserTest::SetUp(); |
56 DCHECK(CommandLine::ForCurrentProcess()->HasSwitch( | 56 DCHECK(switches::IsNewAvatarMenu()); |
57 switches::kNewAvatarMenu)); | |
58 } | 57 } |
59 | 58 |
60 void ProfileChooserViewBrowserTest::SetUpCommandLine( | 59 void ProfileChooserViewBrowserTest::SetUpCommandLine( |
61 CommandLine* command_line) { | 60 CommandLine* command_line) { |
62 command_line->AppendSwitch(switches::kNewAvatarMenu); | 61 switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); |
63 } | 62 } |
64 | 63 |
65 void ProfileChooserViewBrowserTest::OpenProfileChooserView() { | 64 void ProfileChooserViewBrowserTest::OpenProfileChooserView() { |
66 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 65 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
67 NewAvatarButton* button = browser_view->frame()->GetNewAvatarMenuButton(); | 66 NewAvatarButton* button = browser_view->frame()->GetNewAvatarMenuButton(); |
68 ASSERT_TRUE(button); | 67 ASSERT_TRUE(button); |
69 | 68 |
70 ProfileChooserView::clear_close_on_deactivate_for_testing(); | 69 ProfileChooserView::clear_close_on_deactivate_for_testing(); |
71 ui::MouseEvent mouse_ev(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0, | 70 ui::MouseEvent mouse_ev(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 0, |
72 0); | 71 0); |
(...skipping 22 matching lines...) Expand all Loading... |
95 | 94 |
96 Profile* profile = browser()->profile(); | 95 Profile* profile = browser()->profile(); |
97 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarTutorialShown, 0); | 96 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarTutorialShown, 0); |
98 | 97 |
99 ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView()); | 98 ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView()); |
100 | 99 |
101 histograms.Fetch(); | 100 histograms.Fetch(); |
102 histograms.ExpectUniqueSample("Profile.UpgradeEnrollment", | 101 histograms.ExpectUniqueSample("Profile.UpgradeEnrollment", |
103 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO, 1); | 102 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO, 1); |
104 } | 103 } |
OLD | NEW |