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

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

Issue 1708583003: Pass data saver pref value into embedded worker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed nits Created 4 years, 9 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/bind.h" 5 #include "base/bind.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "content/browser/service_worker/service_worker_process_manager.h" 8 #include "content/browser/service_worker/service_worker_process_manager.h"
9 #include "content/common/service_worker/embedded_worker_settings.h"
9 #include "content/public/common/child_process_host.h" 10 #include "content/public/common/child_process_host.h"
10 #include "content/public/test/mock_render_process_host.h" 11 #include "content/public/test/mock_render_process_host.h"
11 #include "content/public/test/test_browser_context.h" 12 #include "content/public/test/test_browser_context.h"
12 #include "content/public/test/test_browser_thread_bundle.h" 13 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "url/gurl.h" 16 #include "url/gurl.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 namespace { 20 namespace {
20 21
21 void DidAllocateWorkerProcess(const base::Closure& quit_closure, 22 void DidAllocateWorkerProcess(const base::Closure& quit_closure,
22 ServiceWorkerStatusCode* status_out, 23 ServiceWorkerStatusCode* status_out,
23 int* process_id_out, 24 int* process_id_out,
24 bool* is_new_process_out, 25 bool* is_new_process_out,
25 ServiceWorkerStatusCode status, 26 ServiceWorkerStatusCode status,
26 int process_id, 27 int process_id,
27 bool is_new_process) { 28 bool is_new_process,
29 const EmbeddedWorkerSettings& settings) {
28 *status_out = status; 30 *status_out = status;
29 *process_id_out = process_id; 31 *process_id_out = process_id;
30 *is_new_process_out = is_new_process; 32 *is_new_process_out = is_new_process;
31 quit_closure.Run(); 33 quit_closure.Run();
32 } 34 }
33 35
34 } // namespace 36 } // namespace
35 37
36 class ServiceWorkerProcessManagerTest : public testing::Test { 38 class ServiceWorkerProcessManagerTest : public testing::Test {
37 public: 39 public:
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 run_loop.Run(); 245 run_loop.Run();
244 246
245 // Allocating a process in shutdown should abort. 247 // Allocating a process in shutdown should abort.
246 EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status); 248 EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status);
247 EXPECT_EQ(ChildProcessHost::kInvalidUniqueID, process_id); 249 EXPECT_EQ(ChildProcessHost::kInvalidUniqueID, process_id);
248 EXPECT_FALSE(is_new_process); 250 EXPECT_FALSE(is_new_process);
249 EXPECT_TRUE(process_manager_->instance_info_.empty()); 251 EXPECT_TRUE(process_manager_->instance_info_.empty());
250 } 252 }
251 253
252 } // namespace content 254 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698