| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ios/chrome/browser/device_sharing/device_sharing_manager.h" | 5 #include "ios/chrome/browser/device_sharing/device_sharing_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 protected: | 34 protected: |
| 35 DeviceSharingManagerTest() | 35 DeviceSharingManagerTest() |
| 36 : PlatformTest(), | 36 : PlatformTest(), |
| 37 kTestURL1("http://test_sharing_1.html"), | 37 kTestURL1("http://test_sharing_1.html"), |
| 38 kTestURL2("http://test_sharing_2.html") {} | 38 kTestURL2("http://test_sharing_2.html") {} |
| 39 | 39 |
| 40 void SetUp() override { | 40 void SetUp() override { |
| 41 PlatformTest::SetUp(); | 41 PlatformTest::SetUp(); |
| 42 TestChromeBrowserState::Builder mainBrowserStateBuilder; | 42 TestChromeBrowserState::Builder mainBrowserStateBuilder; |
| 43 chrome_browser_state_ = mainBrowserStateBuilder.Build(); | 43 chrome_browser_state_ = mainBrowserStateBuilder.Build(); |
| 44 sync_preferences::TestingPrefServiceSyncable* prefs = | |
| 45 chrome_browser_state_->GetTestingPrefService(); | |
| 46 [HandoffManager registerBrowserStatePrefs:prefs->registry()]; | |
| 47 sharing_manager_.reset([[TestDeviceSharingManager alloc] init]); | 44 sharing_manager_.reset([[TestDeviceSharingManager alloc] init]); |
| 48 } | 45 } |
| 49 | 46 |
| 50 void TearDown() override { | 47 void TearDown() override { |
| 51 [sharing_manager_ updateBrowserState:NULL]; | 48 [sharing_manager_ updateBrowserState:NULL]; |
| 52 sharing_manager_.reset(); | 49 sharing_manager_.reset(); |
| 53 } | 50 } |
| 54 | 51 |
| 55 const GURL kTestURL1; | 52 const GURL kTestURL1; |
| 56 const GURL kTestURL2; | 53 const GURL kTestURL2; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 TEST_F(DeviceSharingManagerTest, DisableHandoffViaPrefs) { | 104 TEST_F(DeviceSharingManagerTest, DisableHandoffViaPrefs) { |
| 108 [sharing_manager_ updateBrowserState:chrome_browser_state_.get()]; | 105 [sharing_manager_ updateBrowserState:chrome_browser_state_.get()]; |
| 109 EXPECT_TRUE([sharing_manager_ handoffManager]); | 106 EXPECT_TRUE([sharing_manager_ handoffManager]); |
| 110 sync_preferences::TestingPrefServiceSyncable* prefs = | 107 sync_preferences::TestingPrefServiceSyncable* prefs = |
| 111 chrome_browser_state_->GetTestingPrefService(); | 108 chrome_browser_state_->GetTestingPrefService(); |
| 112 prefs->SetBoolean(prefs::kIosHandoffToOtherDevices, false); | 109 prefs->SetBoolean(prefs::kIosHandoffToOtherDevices, false); |
| 113 EXPECT_FALSE([sharing_manager_ handoffManager]); | 110 EXPECT_FALSE([sharing_manager_ handoffManager]); |
| 114 } | 111 } |
| 115 | 112 |
| 116 } // namespace | 113 } // namespace |
| OLD | NEW |