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

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

Issue 2706923003: Add UMA for how long service workers run for. (Closed)
Patch Set: tweaks, fmt Created 3 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 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/browser/service_worker/embedded_worker_instance.h" 5 #include "content/browser/service_worker/embedded_worker_instance.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, worker->status()); 312 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, worker->status());
313 EXPECT_EQ(helper_->mock_render_process_id(), worker->process_id()); 313 EXPECT_EQ(helper_->mock_render_process_id(), worker->process_id());
314 worker->StopIfIdle(); 314 worker->StopIfIdle();
315 EXPECT_EQ(EmbeddedWorkerStatus::STOPPING, worker->status()); 315 EXPECT_EQ(EmbeddedWorkerStatus::STOPPING, worker->status());
316 base::RunLoop().RunUntilIdle(); 316 base::RunLoop().RunUntilIdle();
317 317
318 // The worker must be stopped now. 318 // The worker must be stopped now.
319 EXPECT_EQ(EmbeddedWorkerStatus::STOPPED, worker->status()); 319 EXPECT_EQ(EmbeddedWorkerStatus::STOPPED, worker->status());
320 320
321 // Set devtools_attached to true, and do the same. 321 // Set devtools_attached to true, and do the same.
322 worker->set_devtools_attached(true); 322 worker->SetDevToolsAttached(true);
323 323
324 EXPECT_EQ(SERVICE_WORKER_OK, 324 EXPECT_EQ(SERVICE_WORKER_OK,
325 StartWorker(worker.get(), service_worker_version_id, pattern, url)); 325 StartWorker(worker.get(), service_worker_version_id, pattern, url));
326 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, worker->status()); 326 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, worker->status());
327 EXPECT_EQ(helper_->mock_render_process_id(), worker->process_id()); 327 EXPECT_EQ(helper_->mock_render_process_id(), worker->process_id());
328 worker->StopIfIdle(); 328 worker->StopIfIdle();
329 base::RunLoop().RunUntilIdle(); 329 base::RunLoop().RunUntilIdle();
330 330
331 // The worker must not be stopped this time. 331 // The worker must not be stopped this time.
332 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, worker->status()); 332 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, worker->status());
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 ASSERT_EQ(1UL, instance_client_rawptr->message().size()); 811 ASSERT_EQ(1UL, instance_client_rawptr->message().size());
812 EXPECT_EQ(test_message, instance_client_rawptr->message()[0]); 812 EXPECT_EQ(test_message, instance_client_rawptr->message()[0]);
813 813
814 // Ensure the worker is stopped. 814 // Ensure the worker is stopped.
815 worker->Stop(); 815 worker->Stop();
816 base::RunLoop().RunUntilIdle(); 816 base::RunLoop().RunUntilIdle();
817 EXPECT_EQ(EmbeddedWorkerStatus::STOPPED, worker->status()); 817 EXPECT_EQ(EmbeddedWorkerStatus::STOPPED, worker->status());
818 } 818 }
819 819
820 } // namespace content 820 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/embedded_worker_instance.cc ('k') | content/browser/service_worker/embedded_worker_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698