| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 origin, notification_database_data, | 382 origin, notification_database_data, |
| 383 base::Bind(&PlatformNotificationContextTest::DidWriteNotificationData, | 383 base::Bind(&PlatformNotificationContextTest::DidWriteNotificationData, |
| 384 base::Unretained(this))); | 384 base::Unretained(this))); |
| 385 | 385 |
| 386 base::RunLoop().RunUntilIdle(); | 386 base::RunLoop().RunUntilIdle(); |
| 387 | 387 |
| 388 // The write operation should have succeeded with a notification id. | 388 // The write operation should have succeeded with a notification id. |
| 389 ASSERT_TRUE(success()); | 389 ASSERT_TRUE(success()); |
| 390 EXPECT_FALSE(notification_id().empty()); | 390 EXPECT_FALSE(notification_id().empty()); |
| 391 | 391 |
| 392 // Call the OnStorageWiped override from the ServiceWorkerContextObserver, | 392 // Call the OnStorageWiped override from the ServiceWorkerContextCoreObserver, |
| 393 // which indicates that the database should go away entirely. | 393 // which indicates that the database should go away entirely. |
| 394 context->OnStorageWiped(); | 394 context->OnStorageWiped(); |
| 395 | 395 |
| 396 // Verify that reading notification data fails because the data does not | 396 // Verify that reading notification data fails because the data does not |
| 397 // exist anymore. Deliberately omit RunUntilIdle(), since this is unlikely to | 397 // exist anymore. Deliberately omit RunUntilIdle(), since this is unlikely to |
| 398 // be the case when OnStorageWiped gets called in production. | 398 // be the case when OnStorageWiped gets called in production. |
| 399 context->ReadNotificationData( | 399 context->ReadNotificationData( |
| 400 notification_id(), origin, | 400 notification_id(), origin, |
| 401 base::Bind(&PlatformNotificationContextTest::DidReadNotificationData, | 401 base::Bind(&PlatformNotificationContextTest::DidReadNotificationData, |
| 402 base::Unretained(this))); | 402 base::Unretained(this))); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 base::Unretained(this))); | 559 base::Unretained(this))); |
| 560 | 560 |
| 561 base::RunLoop().RunUntilIdle(); | 561 base::RunLoop().RunUntilIdle(); |
| 562 | 562 |
| 563 // The notification was removed, so we shouldn't be able to read it from | 563 // The notification was removed, so we shouldn't be able to read it from |
| 564 // the database anymore. | 564 // the database anymore. |
| 565 EXPECT_FALSE(success()); | 565 EXPECT_FALSE(success()); |
| 566 } | 566 } |
| 567 | 567 |
| 568 } // namespace content | 568 } // namespace content |
| OLD | NEW |