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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 void ExpectRegisteredWorkers( | 56 void ExpectRegisteredWorkers( |
57 ServiceWorkerStatusCode expect_status, | 57 ServiceWorkerStatusCode expect_status, |
58 int64 expect_version_id, | 58 int64 expect_version_id, |
59 bool expect_waiting, | 59 bool expect_waiting, |
60 bool expect_active, | 60 bool expect_active, |
61 ServiceWorkerStatusCode status, | 61 ServiceWorkerStatusCode status, |
62 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 62 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
63 ASSERT_EQ(expect_status, status); | 63 ASSERT_EQ(expect_status, status); |
64 if (status != SERVICE_WORKER_OK) { | 64 if (status != SERVICE_WORKER_OK) { |
65 EXPECT_FALSE(registration); | 65 EXPECT_FALSE(registration.get()); |
66 return; | 66 return; |
67 } | 67 } |
68 | 68 |
69 if (expect_waiting) { | 69 if (expect_waiting) { |
70 EXPECT_TRUE(registration->waiting_version()); | 70 EXPECT_TRUE(registration->waiting_version()); |
71 EXPECT_EQ(expect_version_id, | 71 EXPECT_EQ(expect_version_id, |
72 registration->waiting_version()->version_id()); | 72 registration->waiting_version()->version_id()); |
73 } else { | 73 } else { |
74 EXPECT_FALSE(registration->waiting_version()); | 74 EXPECT_FALSE(registration->waiting_version()); |
75 } | 75 } |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 GURL("http://www.example.com"), | 451 GURL("http://www.example.com"), |
452 base::Bind(&ExpectRegisteredWorkers, | 452 base::Bind(&ExpectRegisteredWorkers, |
453 SERVICE_WORKER_OK, | 453 SERVICE_WORKER_OK, |
454 version_id, | 454 version_id, |
455 false /* expect_waiting */, | 455 false /* expect_waiting */, |
456 true /* expect_active */)); | 456 true /* expect_active */)); |
457 base::RunLoop().RunUntilIdle(); | 457 base::RunLoop().RunUntilIdle(); |
458 } | 458 } |
459 | 459 |
460 } // namespace content | 460 } // namespace content |
OLD | NEW |