Revert of Add button to add new FSP services to Files app. (patchset #8 id:140001...
[chromium-blink-merge.git] / chrome / browser / ui / sync / sync_promo_ui_unittest.cc
blobe19b22c555fc7e767cf4fe4db7a97f3a6d9e96fc
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.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 "testing/gtest/include/gtest/gtest.h"
17 class SyncPromoUITest : public testing::Test {
18 public:
19 SyncPromoUITest() {}
21 // testing::Test:
22 void SetUp() override {
23 testing::Test::SetUp();
24 TestingProfile::Builder builder;
25 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
26 FakeSigninManagerBase::Build);
27 profile_ = builder.Build();
30 protected:
31 void DisableSync() {
32 base::CommandLine::ForCurrentProcess()->AppendSwitch(
33 switches::kDisableSync);
36 scoped_ptr<TestingProfile> profile_;
38 private:
39 DISALLOW_COPY_AND_ASSIGN(SyncPromoUITest);
42 // Verifies that ShouldShowSyncPromo returns false if sync is disabled by
43 // policy.
44 TEST_F(SyncPromoUITest, ShouldShowSyncPromoSyncDisabled) {
45 DisableSync();
46 EXPECT_FALSE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
49 // Verifies that ShouldShowSyncPromo returns true if all conditions to
50 // show the promo are met.
51 TEST_F(SyncPromoUITest, ShouldShowSyncPromoSyncEnabled) {
52 #if defined(OS_CHROMEOS)
53 // No sync promo on CrOS.
54 EXPECT_FALSE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
55 #else
56 EXPECT_TRUE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
57 #endif