| OLD | NEW |
| 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 "content/public/browser/service_worker_context.h" | 5 #include "content/public/browser/service_worker_context.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "content/browser/browser_thread_impl.h" | 10 #include "content/browser/browser_thread_impl.h" |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 script_url, | 332 script_url, |
| 333 NULL, | 333 NULL, |
| 334 MakeRegisteredCallback(&called, &new_registration_id)); | 334 MakeRegisteredCallback(&called, &new_registration_id)); |
| 335 | 335 |
| 336 ASSERT_FALSE(called); | 336 ASSERT_FALSE(called); |
| 337 base::RunLoop().RunUntilIdle(); | 337 base::RunLoop().RunUntilIdle(); |
| 338 ASSERT_TRUE(called); | 338 ASSERT_TRUE(called); |
| 339 EXPECT_EQ(old_registration_id, new_registration_id); | 339 EXPECT_EQ(old_registration_id, new_registration_id); |
| 340 } | 340 } |
| 341 | 341 |
| 342 // TODO(jmadill): Fix on Windows 8. http://crbug.com/420124 | |
| 343 #if defined(OS_WIN) | |
| 344 #define MAYBE_DeleteAndStartOver DISABLED_DeleteAndStartOver | |
| 345 #else | |
| 346 #define MAYBE_DeleteAndStartOver DeleteAndStartOver | |
| 347 #endif | |
| 348 | |
| 349 // TODO(nhiroki): Test this for on-disk storage. | 342 // TODO(nhiroki): Test this for on-disk storage. |
| 350 TEST_F(ServiceWorkerContextTest, MAYBE_DeleteAndStartOver) { | 343 TEST_F(ServiceWorkerContextTest, DeleteAndStartOver) { |
| 351 int64 registration_id = kInvalidServiceWorkerRegistrationId; | 344 int64 registration_id = kInvalidServiceWorkerRegistrationId; |
| 352 bool called = false; | 345 bool called = false; |
| 353 context()->RegisterServiceWorker( | 346 context()->RegisterServiceWorker( |
| 354 GURL("http://www.example.com/"), | 347 GURL("http://www.example.com/"), |
| 355 GURL("http://www.example.com/service_worker.js"), | 348 GURL("http://www.example.com/service_worker.js"), |
| 356 NULL, | 349 NULL, |
| 357 MakeRegisteredCallback(&called, ®istration_id)); | 350 MakeRegisteredCallback(&called, ®istration_id)); |
| 358 | 351 |
| 359 ASSERT_FALSE(called); | 352 ASSERT_FALSE(called); |
| 360 base::RunLoop().RunUntilIdle(); | 353 base::RunLoop().RunUntilIdle(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 false /* expect_waiting */, | 409 false /* expect_waiting */, |
| 417 true /* expect_active */)); | 410 true /* expect_active */)); |
| 418 base::RunLoop().RunUntilIdle(); | 411 base::RunLoop().RunUntilIdle(); |
| 419 | 412 |
| 420 // The new context should take over next handle ids. | 413 // The new context should take over next handle ids. |
| 421 EXPECT_EQ(1, context()->GetNewServiceWorkerHandleId()); | 414 EXPECT_EQ(1, context()->GetNewServiceWorkerHandleId()); |
| 422 EXPECT_EQ(1, context()->GetNewRegistrationHandleId()); | 415 EXPECT_EQ(1, context()->GetNewRegistrationHandleId()); |
| 423 } | 416 } |
| 424 | 417 |
| 425 } // namespace content | 418 } // namespace content |
| OLD | NEW |