OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "content/browser/service_worker/embedded_worker_instance.h" | 9 #include "content/browser/service_worker/embedded_worker_instance.h" |
10 #include "content/browser/service_worker/embedded_worker_registry.h" | 10 #include "content/browser/service_worker/embedded_worker_registry.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 ASSERT_FALSE(done_closure_.is_null()); | 148 ASSERT_FALSE(done_closure_.is_null()); |
149 last_worker_status_ = worker_->status(); | 149 last_worker_status_ = worker_->status(); |
150 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); | 150 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); |
151 } | 151 } |
152 virtual void OnStopped() OVERRIDE { | 152 virtual void OnStopped() OVERRIDE { |
153 ASSERT_TRUE(worker_ != NULL); | 153 ASSERT_TRUE(worker_ != NULL); |
154 ASSERT_FALSE(done_closure_.is_null()); | 154 ASSERT_FALSE(done_closure_.is_null()); |
155 last_worker_status_ = worker_->status(); | 155 last_worker_status_ = worker_->status(); |
156 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); | 156 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); |
157 } | 157 } |
158 virtual void OnMessageReceived(const IPC::Message& message) OVERRIDE { | 158 virtual void OnMessageReceived( |
| 159 int request_id, const IPC::Message& message) OVERRIDE { |
159 NOTREACHED(); | 160 NOTREACHED(); |
160 } | 161 } |
161 | 162 |
162 scoped_ptr<EmbeddedWorkerInstance> worker_; | 163 scoped_ptr<EmbeddedWorkerInstance> worker_; |
163 EmbeddedWorkerInstance::Status last_worker_status_; | 164 EmbeddedWorkerInstance::Status last_worker_status_; |
164 | 165 |
165 // Called by EmbeddedWorkerInstance::Observer overrides so that | 166 // Called by EmbeddedWorkerInstance::Observer overrides so that |
166 // test code can wait for the worker status notifications. | 167 // test code can wait for the worker status notifications. |
167 base::Closure done_closure_; | 168 base::Closure done_closure_; |
168 }; | 169 }; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 278 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
278 base::Bind(&self::StartOnIOThread, this, | 279 base::Bind(&self::StartOnIOThread, this, |
279 "/service_worker/nonexistent.js", | 280 "/service_worker/nonexistent.js", |
280 start_run_loop.QuitClosure(), | 281 start_run_loop.QuitClosure(), |
281 &status)); | 282 &status)); |
282 start_run_loop.Run(); | 283 start_run_loop.Run(); |
283 ASSERT_EQ(SERVICE_WORKER_ERROR_START_WORKER_FAILED, status); | 284 ASSERT_EQ(SERVICE_WORKER_ERROR_START_WORKER_FAILED, status); |
284 } | 285 } |
285 | 286 |
286 } // namespace content | 287 } // namespace content |
OLD | NEW |