Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / sync / sync_promo_ui_unittest.cc
blob0251158659efa4efca37abe99f90074f7f6620b8
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/sync/sync_promo_ui.h"
7 #include "base/basictypes.h"
8 #include "base/command_line.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/signin/fake_signin_manager_builder.h"
12 #include "chrome/browser/signin/signin_manager_factory.h"
13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/test/base/testing_profile.h"
15 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "testing/gtest/include/gtest/gtest.h"
18 class SyncPromoUITest : public testing::Test {
19 public:
20 SyncPromoUITest() {}
22 // testing::Test:
23 void SetUp() override {
24 testing::Test::SetUp();
25 TestingProfile::Builder builder;
26 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
27 BuildFakeSigninManagerBase);
28 profile_ = builder.Build();
31 protected:
32 void DisableSync() {
33 base::CommandLine::ForCurrentProcess()->AppendSwitch(
34 switches::kDisableSync);
37 content::TestBrowserThreadBundle thread_bundle_;
38 scoped_ptr<TestingProfile> profile_;
40 private:
41 DISALLOW_COPY_AND_ASSIGN(SyncPromoUITest);
44 // Verifies that ShouldShowSyncPromo returns false if sync is disabled by
45 // policy.
46 TEST_F(SyncPromoUITest, ShouldShowSyncPromoSyncDisabled) {
47 DisableSync();
48 EXPECT_FALSE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
51 // Verifies that ShouldShowSyncPromo returns true if all conditions to
52 // show the promo are met.
53 TEST_F(SyncPromoUITest, ShouldShowSyncPromoSyncEnabled) {
54 #if defined(OS_CHROMEOS)
55 // No sync promo on CrOS.
56 EXPECT_FALSE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
57 #else
58 EXPECT_TRUE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
59 #endif