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