Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: content/browser/service_worker/service_worker_handle_unittest.cc

Issue 443593002: ServiceWorker: Move worker candidate process knowledge to ServiceWorkerProcessManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "content/browser/service_worker/embedded_worker_registry.h" 7 #include "content/browser/service_worker/embedded_worker_registry.h"
8 #include "content/browser/service_worker/embedded_worker_test_helper.h" 8 #include "content/browser/service_worker/embedded_worker_test_helper.h"
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_handle.h" 10 #include "content/browser/service_worker/service_worker_handle.h"
(...skipping 28 matching lines...) Expand all
39 } // namespace 39 } // namespace
40 40
41 class ServiceWorkerHandleTest : public testing::Test { 41 class ServiceWorkerHandleTest : public testing::Test {
42 public: 42 public:
43 ServiceWorkerHandleTest() 43 ServiceWorkerHandleTest()
44 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {} 44 : browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP) {}
45 45
46 virtual void SetUp() OVERRIDE { 46 virtual void SetUp() OVERRIDE {
47 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId)); 47 helper_.reset(new EmbeddedWorkerTestHelper(kRenderProcessId));
48 48
49 const GURL scope("http://www.example.com/*");
dominicc (has gone to gerrit) 2014/08/06 06:48:18 * has no special meaning in scopes now (scopes are
xiang 2014/08/11 04:50:55 Done.
49 registration_ = new ServiceWorkerRegistration( 50 registration_ = new ServiceWorkerRegistration(
50 GURL("http://www.example.com/*"), 51 scope,
51 GURL("http://www.example.com/service_worker.js"), 52 GURL("http://www.example.com/service_worker.js"),
52 1L, 53 1L,
53 helper_->context()->AsWeakPtr()); 54 helper_->context()->AsWeakPtr());
54 version_ = new ServiceWorkerVersion( 55 version_ = new ServiceWorkerVersion(
55 registration_, 1L, helper_->context()->AsWeakPtr()); 56 registration_, 1L, helper_->context()->AsWeakPtr());
56 57 helper_->SimulateAddProcessToScope(scope, kRenderProcessId);
57 // Simulate adding one process to the worker.
58 int embedded_worker_id = version_->embedded_worker()->embedded_worker_id();
59 helper_->SimulateAddProcessToWorker(embedded_worker_id, kRenderProcessId);
60 } 58 }
61 59
62 virtual void TearDown() OVERRIDE { 60 virtual void TearDown() OVERRIDE {
63 registration_ = NULL; 61 registration_ = NULL;
64 version_ = NULL; 62 version_ = NULL;
65 helper_.reset(); 63 helper_.reset();
66 } 64 }
67 65
68 IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); } 66 IPC::TestSink* ipc_sink() { return helper_->ipc_sink(); }
69 67
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // 3. SendMessageToWorker (to send InstallEvent), and 108 // 3. SendMessageToWorker (to send InstallEvent), and
111 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID, 109 EXPECT_EQ(EmbeddedWorkerContextMsg_MessageToWorker::ID,
112 ipc_sink()->GetMessageAt(2)->type()); 110 ipc_sink()->GetMessageAt(2)->type());
113 // 4. StateChanged (state == Installed). 111 // 4. StateChanged (state == Installed).
114 VerifyStateChangedMessage(handle->handle_id(), 112 VerifyStateChangedMessage(handle->handle_id(),
115 blink::WebServiceWorkerStateInstalled, 113 blink::WebServiceWorkerStateInstalled,
116 ipc_sink()->GetMessageAt(3)); 114 ipc_sink()->GetMessageAt(3));
117 } 115 }
118 116
119 } // namespace content 117 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698