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/signin/chrome_signin_status_metrics_provider_delegate.h
" | 5 #include "chrome/browser/signin/chrome_signin_status_metrics_provider_delegate.h
" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "components/signin/core/browser/signin_status_metrics_provider.h" | 10 #include "components/signin/core/browser/signin_status_metrics_provider.h" |
11 #include "content/public/test/test_browser_thread_bundle.h" | 11 #include "content/public/test/test_browser_thread_bundle.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 #if !defined(OS_ANDROID) | 14 #if !defined(OS_ANDROID) |
15 TEST(ChromeSigninStatusMetricsProviderDelegateTest, | 15 TEST(ChromeSigninStatusMetricsProviderDelegateTest, |
16 UpdateStatusWhenBrowserAdded) { | 16 UpdateStatusWhenBrowserAdded) { |
17 content::TestBrowserThreadBundle thread_bundle; | 17 content::TestBrowserThreadBundle thread_bundle; |
18 | 18 |
19 std::unique_ptr<ChromeSigninStatusMetricsProviderDelegate> delegate( | 19 std::unique_ptr<ChromeSigninStatusMetricsProviderDelegate> delegate( |
20 new ChromeSigninStatusMetricsProviderDelegate); | 20 new ChromeSigninStatusMetricsProviderDelegate); |
21 ChromeSigninStatusMetricsProviderDelegate* raw_delegate = delegate.get(); | 21 ChromeSigninStatusMetricsProviderDelegate* raw_delegate = delegate.get(); |
22 std::unique_ptr<SigninStatusMetricsProvider> metrics_provider( | 22 std::unique_ptr<SigninStatusMetricsProvider> metrics_provider = |
23 SigninStatusMetricsProvider::CreateInstance(std::move(delegate))); | 23 SigninStatusMetricsProvider::CreateInstance(std::move(delegate)); |
24 | 24 |
25 // Initial status is all signed in and then a signed-in browser is opened. | 25 // Initial status is all signed in and then a signed-in browser is opened. |
26 metrics_provider->UpdateInitialSigninStatusForTesting(2, 2); | 26 metrics_provider->UpdateInitialSigninStatusForTesting(2, 2); |
27 raw_delegate->UpdateStatusWhenBrowserAdded(true); | 27 raw_delegate->UpdateStatusWhenBrowserAdded(true); |
28 EXPECT_EQ(SigninStatusMetricsProviderBase::ALL_PROFILES_SIGNED_IN, | 28 EXPECT_EQ(SigninStatusMetricsProviderBase::ALL_PROFILES_SIGNED_IN, |
29 metrics_provider->GetSigninStatusForTesting()); | 29 metrics_provider->GetSigninStatusForTesting()); |
30 | 30 |
31 // Initial status is all signed in and then a signed-out browser is opened. | 31 // Initial status is all signed in and then a signed-out browser is opened. |
32 metrics_provider->UpdateInitialSigninStatusForTesting(2, 2); | 32 metrics_provider->UpdateInitialSigninStatusForTesting(2, 2); |
33 raw_delegate->UpdateStatusWhenBrowserAdded(false); | 33 raw_delegate->UpdateStatusWhenBrowserAdded(false); |
(...skipping 18 matching lines...) Expand all Loading... |
52 EXPECT_EQ(SigninStatusMetricsProviderBase::MIXED_SIGNIN_STATUS, | 52 EXPECT_EQ(SigninStatusMetricsProviderBase::MIXED_SIGNIN_STATUS, |
53 metrics_provider->GetSigninStatusForTesting()); | 53 metrics_provider->GetSigninStatusForTesting()); |
54 | 54 |
55 // Initial status is mixed and then a signed-out browser is opened. | 55 // Initial status is mixed and then a signed-out browser is opened. |
56 metrics_provider->UpdateInitialSigninStatusForTesting(2, 1); | 56 metrics_provider->UpdateInitialSigninStatusForTesting(2, 1); |
57 raw_delegate->UpdateStatusWhenBrowserAdded(false); | 57 raw_delegate->UpdateStatusWhenBrowserAdded(false); |
58 EXPECT_EQ(SigninStatusMetricsProviderBase::MIXED_SIGNIN_STATUS, | 58 EXPECT_EQ(SigninStatusMetricsProviderBase::MIXED_SIGNIN_STATUS, |
59 metrics_provider->GetSigninStatusForTesting()); | 59 metrics_provider->GetSigninStatusForTesting()); |
60 } | 60 } |
61 #endif | 61 #endif |
OLD | NEW |