Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1370)

Side by Side Diff: chrome/browser/ui/sync/sync_promo_ui_unittest.cc

Issue 1865213004: Convert //chrome/browser/ui from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/sync/sync_promo_ui.h" 5 #include "chrome/browser/ui/sync/sync_promo_ui.h"
6 6
7 #include <memory>
8
7 #include "base/command_line.h" 9 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "build/build_config.h" 12 #include "build/build_config.h"
12 #include "chrome/browser/signin/fake_signin_manager_builder.h" 13 #include "chrome/browser/signin/fake_signin_manager_builder.h"
13 #include "chrome/browser/signin/signin_manager_factory.h" 14 #include "chrome/browser/signin/signin_manager_factory.h"
14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
15 #include "chrome/test/base/testing_profile.h" 16 #include "chrome/test/base/testing_profile.h"
16 #include "components/browser_sync/common/browser_sync_switches.h" 17 #include "components/browser_sync/common/browser_sync_switches.h"
17 #include "content/public/test/test_browser_thread_bundle.h" 18 #include "content/public/test/test_browser_thread_bundle.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 class SyncPromoUITest : public testing::Test { 21 class SyncPromoUITest : public testing::Test {
21 public: 22 public:
22 SyncPromoUITest() {} 23 SyncPromoUITest() {}
23 24
24 // testing::Test: 25 // testing::Test:
25 void SetUp() override { 26 void SetUp() override {
26 testing::Test::SetUp(); 27 testing::Test::SetUp();
27 TestingProfile::Builder builder; 28 TestingProfile::Builder builder;
28 builder.AddTestingFactory(SigninManagerFactory::GetInstance(), 29 builder.AddTestingFactory(SigninManagerFactory::GetInstance(),
29 BuildFakeSigninManagerBase); 30 BuildFakeSigninManagerBase);
30 profile_ = builder.Build(); 31 profile_ = builder.Build();
31 } 32 }
32 33
33 protected: 34 protected:
34 void DisableSync() { 35 void DisableSync() {
35 base::CommandLine::ForCurrentProcess()->AppendSwitch( 36 base::CommandLine::ForCurrentProcess()->AppendSwitch(
36 switches::kDisableSync); 37 switches::kDisableSync);
37 } 38 }
38 39
39 content::TestBrowserThreadBundle thread_bundle_; 40 content::TestBrowserThreadBundle thread_bundle_;
40 scoped_ptr<TestingProfile> profile_; 41 std::unique_ptr<TestingProfile> profile_;
41 42
42 private: 43 private:
43 DISALLOW_COPY_AND_ASSIGN(SyncPromoUITest); 44 DISALLOW_COPY_AND_ASSIGN(SyncPromoUITest);
44 }; 45 };
45 46
46 // Verifies that ShouldShowSyncPromo returns false if sync is disabled by 47 // Verifies that ShouldShowSyncPromo returns false if sync is disabled by
47 // policy. 48 // policy.
48 TEST_F(SyncPromoUITest, ShouldShowSyncPromoSyncDisabled) { 49 TEST_F(SyncPromoUITest, ShouldShowSyncPromoSyncDisabled) {
49 DisableSync(); 50 DisableSync();
50 EXPECT_FALSE(SyncPromoUI::ShouldShowSyncPromo(profile_.get())); 51 EXPECT_FALSE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
51 } 52 }
52 53
53 // Verifies that ShouldShowSyncPromo returns true if all conditions to 54 // Verifies that ShouldShowSyncPromo returns true if all conditions to
54 // show the promo are met. 55 // show the promo are met.
55 TEST_F(SyncPromoUITest, ShouldShowSyncPromoSyncEnabled) { 56 TEST_F(SyncPromoUITest, ShouldShowSyncPromoSyncEnabled) {
56 #if defined(OS_CHROMEOS) 57 #if defined(OS_CHROMEOS)
57 // No sync promo on CrOS. 58 // No sync promo on CrOS.
58 EXPECT_FALSE(SyncPromoUI::ShouldShowSyncPromo(profile_.get())); 59 EXPECT_FALSE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
59 #else 60 #else
60 EXPECT_TRUE(SyncPromoUI::ShouldShowSyncPromo(profile_.get())); 61 EXPECT_TRUE(SyncPromoUI::ShouldShowSyncPromo(profile_.get()));
61 #endif 62 #endif
62 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698