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" |
11 #include "base/test/histogram_tester.h" | |
11 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/profiles/profile_metrics.h" | 14 #include "chrome/browser/profiles/profile_metrics.h" |
14 #include "chrome/browser/profiles/profiles_state.h" | 15 #include "chrome/browser/profiles/profiles_state.h" |
15 #include "chrome/browser/ui/browser_dialogs.h" | 16 #include "chrome/browser/ui/browser_dialogs.h" |
16 #include "chrome/browser/ui/browser_list.h" | 17 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/browser/ui/views/frame/browser_view.h" | 18 #include "chrome/browser/ui/views/frame/browser_view.h" |
18 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 19 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" |
19 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" | 20 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" |
20 #include "chrome/browser/ui/views/profiles/user_manager_view.h" | 21 #include "chrome/browser/ui/views/profiles/user_manager_view.h" |
21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "chrome/test/base/in_process_browser_test.h" | 25 #include "chrome/test/base/in_process_browser_test.h" |
25 #include "chrome/test/base/test_switches.h" | 26 #include "chrome/test/base/test_switches.h" |
26 #include "chrome/test/base/testing_browser_process.h" | 27 #include "chrome/test/base/testing_browser_process.h" |
27 #include "chrome/test/base/testing_profile_manager.h" | 28 #include "chrome/test/base/testing_profile_manager.h" |
28 #include "chrome/test/base/uma_histogram_helper.h" | |
29 #include "components/signin/core/common/profile_management_switches.h" | 29 #include "components/signin/core/common/profile_management_switches.h" |
30 #include "content/public/test/test_utils.h" | 30 #include "content/public/test/test_utils.h" |
31 #include "grit/generated_resources.h" | 31 #include "grit/generated_resources.h" |
32 #include "ui/views/controls/button/label_button.h" | 32 #include "ui/views/controls/button/label_button.h" |
33 | 33 |
34 class ProfileChooserViewBrowserTest : public InProcessBrowserTest { | 34 class ProfileChooserViewBrowserTest : public InProcessBrowserTest { |
35 public: | 35 public: |
36 ProfileChooserViewBrowserTest(); | 36 ProfileChooserViewBrowserTest(); |
37 virtual ~ProfileChooserViewBrowserTest(); | 37 virtual ~ProfileChooserViewBrowserTest(); |
38 | 38 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 // This test doesn't make sense for ChromeOS since it has a different | 79 // This test doesn't make sense for ChromeOS since it has a different |
80 // multi-profiles menu in the system tray instead. | 80 // multi-profiles menu in the system tray instead. |
81 // | 81 // |
82 // Mobile platforms are also excluded due to a lack of avatar menu. | 82 // Mobile platforms are also excluded due to a lack of avatar menu. |
83 #define MAYBE_ViewProfileUMA DISABLED_ViewProfileUMA | 83 #define MAYBE_ViewProfileUMA DISABLED_ViewProfileUMA |
84 #else | 84 #else |
85 #define MAYBE_ViewProfileUMA ViewProfileUMA | 85 #define MAYBE_ViewProfileUMA ViewProfileUMA |
86 #endif | 86 #endif |
87 | 87 |
88 IN_PROC_BROWSER_TEST_F(ProfileChooserViewBrowserTest, MAYBE_ViewProfileUMA) { | 88 IN_PROC_BROWSER_TEST_F(ProfileChooserViewBrowserTest, MAYBE_ViewProfileUMA) { |
89 UMAHistogramHelper histograms; | 89 base::HistogramTester histograms; |
90 // If multiprofile mode is not enabled, you can't switch between profiles. | 90 // If multiprofile mode is not enabled, you can't switch between profiles. |
91 if (!profiles::IsMultipleProfilesEnabled()) | 91 if (!profiles::IsMultipleProfilesEnabled()) |
92 return; | 92 return; |
93 | 93 |
94 Profile* profile = browser()->profile(); | 94 Profile* profile = browser()->profile(); |
95 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarTutorialShown, 0); | 95 profile->GetPrefs()->SetInteger(prefs::kProfileAvatarTutorialShown, 0); |
96 | 96 |
97 ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView()); | 97 ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView()); |
98 | 98 |
99 histograms.Fetch(); | |
msw
2014/07/18 17:30:25
Were the NaCl tests the only ones that actually re
Ilya Sherman
2014/07/18 17:32:00
Indeed, the NaCl tests were the only ones that act
| |
100 histograms.ExpectUniqueSample("Profile.UpgradeEnrollment", | 99 histograms.ExpectUniqueSample("Profile.UpgradeEnrollment", |
101 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO, 1); | 100 ProfileMetrics::PROFILE_ENROLLMENT_SHOW_PREVIEW_PROMO, 1); |
102 } | 101 } |
OLD | NEW |