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/location.h" | 8 #include "base/location.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "content/browser/service_worker/embedded_worker_instance.h" | 10 #include "content/browser/service_worker/embedded_worker_instance.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 ASSERT_FALSE(done_closure_.is_null()); | 105 ASSERT_FALSE(done_closure_.is_null()); |
106 last_worker_status_ = worker_->status(); | 106 last_worker_status_ = worker_->status(); |
107 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); | 107 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); |
108 } | 108 } |
109 virtual void OnStopped() OVERRIDE { | 109 virtual void OnStopped() OVERRIDE { |
110 ASSERT_TRUE(worker_ != NULL); | 110 ASSERT_TRUE(worker_ != NULL); |
111 ASSERT_FALSE(done_closure_.is_null()); | 111 ASSERT_FALSE(done_closure_.is_null()); |
112 last_worker_status_ = worker_->status(); | 112 last_worker_status_ = worker_->status(); |
113 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); | 113 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, done_closure_); |
114 } | 114 } |
| 115 virtual void OnMessageReceived(const IPC::Message& message) OVERRIDE { |
| 116 NOTREACHED(); |
| 117 } |
115 | 118 |
116 ServiceWorkerProviderHost* GetRegisteredProviderHost() { | 119 ServiceWorkerProviderHost* GetRegisteredProviderHost() { |
117 // Assumes only one provider host is registered at this point. | 120 // Assumes only one provider host is registered at this point. |
118 std::vector<ServiceWorkerProviderHost*> providers; | 121 std::vector<ServiceWorkerProviderHost*> providers; |
119 wrapper_->context()->GetAllProviderHosts(&providers); | 122 wrapper_->context()->GetAllProviderHosts(&providers); |
120 DCHECK_EQ(1U, providers.size()); | 123 DCHECK_EQ(1U, providers.size()); |
121 return providers[0]; | 124 return providers[0]; |
122 } | 125 } |
123 | 126 |
124 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; | 127 scoped_refptr<ServiceWorkerContextWrapper> wrapper_; |
(...skipping 25 matching lines...) Expand all Loading... |
150 done_closure_ = stop_run_loop.QuitClosure(); | 153 done_closure_ = stop_run_loop.QuitClosure(); |
151 BrowserThread::PostTask( | 154 BrowserThread::PostTask( |
152 BrowserThread::IO, FROM_HERE, | 155 BrowserThread::IO, FROM_HERE, |
153 base::Bind(&self::StopEmbeddedWorkerOnIOThread, this)); | 156 base::Bind(&self::StopEmbeddedWorkerOnIOThread, this)); |
154 stop_run_loop.Run(); | 157 stop_run_loop.Run(); |
155 | 158 |
156 ASSERT_EQ(EmbeddedWorkerInstance::STOPPED, last_worker_status_); | 159 ASSERT_EQ(EmbeddedWorkerInstance::STOPPED, last_worker_status_); |
157 } | 160 } |
158 | 161 |
159 } // namespace content | 162 } // namespace content |
OLD | NEW |