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 "content/browser/background_sync/background_sync_service_impl.h" | 5 #include "content/browser/background_sync/background_sync_service_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <utility> | 10 #include <utility> |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 background_sync_test_util::SetIgnoreNetworkChangeNotifier(false); | 116 background_sync_test_util::SetIgnoreNetworkChangeNotifier(false); |
117 } | 117 } |
118 | 118 |
119 // SetUp helper methods | 119 // SetUp helper methods |
120 void CreateTestHelper() { | 120 void CreateTestHelper() { |
121 embedded_worker_helper_.reset( | 121 embedded_worker_helper_.reset( |
122 new EmbeddedWorkerTestHelper(base::FilePath())); | 122 new EmbeddedWorkerTestHelper(base::FilePath())); |
123 std::unique_ptr<MockPermissionManager> mock_permission_manager( | 123 std::unique_ptr<MockPermissionManager> mock_permission_manager( |
124 new testing::NiceMock<MockPermissionManager>()); | 124 new testing::NiceMock<MockPermissionManager>()); |
125 ON_CALL(*mock_permission_manager, | 125 ON_CALL(*mock_permission_manager, |
126 GetPermissionStatus(PermissionType::BACKGROUND_SYNC, _, _)) | 126 GetPermissionStatusForWorker(PermissionType::BACKGROUND_SYNC, _)) |
127 .WillByDefault( | 127 .WillByDefault( |
128 testing::Return(blink::mojom::PermissionStatus::GRANTED)); | 128 testing::Return(blink::mojom::PermissionStatus::GRANTED)); |
129 embedded_worker_helper_->browser_context()->SetPermissionManager( | 129 embedded_worker_helper_->browser_context()->SetPermissionManager( |
130 std::move(mock_permission_manager)); | 130 std::move(mock_permission_manager)); |
131 } | 131 } |
132 | 132 |
133 void CreateStoragePartition() { | 133 void CreateStoragePartition() { |
134 // Creates a StoragePartition so that the BackgroundSyncManager can | 134 // Creates a StoragePartition so that the BackgroundSyncManager can |
135 // use it to access the BrowserContext. | 135 // use it to access the BrowserContext. |
136 storage_partition_impl_.reset(new StoragePartitionImpl( | 136 storage_partition_impl_.reset(new StoragePartitionImpl( |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); | 256 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, register_error); |
257 GetRegistrations(base::Bind(&ErrorAndRegistrationListCallback, | 257 GetRegistrations(base::Bind(&ErrorAndRegistrationListCallback, |
258 &getregistrations_called, &getregistrations_error, | 258 &getregistrations_called, &getregistrations_error, |
259 &array_size)); | 259 &array_size)); |
260 EXPECT_TRUE(getregistrations_called); | 260 EXPECT_TRUE(getregistrations_called); |
261 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); | 261 EXPECT_EQ(blink::mojom::BackgroundSyncError::NONE, getregistrations_error); |
262 EXPECT_EQ(1UL, array_size); | 262 EXPECT_EQ(1UL, array_size); |
263 } | 263 } |
264 | 264 |
265 } // namespace content | 265 } // namespace content |
OLD | NEW |