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

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

Issue 1795863006: service worker: Attribute purpose to start worker attempts for UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for landing? 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 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/service_worker_dispatcher_host.h" 5 #include "content/browser/service_worker/service_worker_dispatcher_host.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 version.get(), 558 version.get(),
559 base::Bind(&SaveStatusCallback, &called, &status)); 559 base::Bind(&SaveStatusCallback, &called, &status));
560 base::RunLoop().RunUntilIdle(); 560 base::RunLoop().RunUntilIdle();
561 EXPECT_TRUE(called); 561 EXPECT_TRUE(called);
562 ASSERT_EQ(SERVICE_WORKER_OK, status); 562 ASSERT_EQ(SERVICE_WORKER_OK, status);
563 563
564 helper_->SimulateAddProcessToPattern(pattern, process_id); 564 helper_->SimulateAddProcessToPattern(pattern, process_id);
565 565
566 // Start up the worker. 566 // Start up the worker.
567 status = SERVICE_WORKER_ERROR_ABORT; 567 status = SERVICE_WORKER_ERROR_ABORT;
568 version->StartWorker(base::Bind(&SaveStatusCallback, &called, &status)); 568 version->StartWorker(ServiceWorkerMetrics::EventType::UNKNOWN,
569 base::Bind(&SaveStatusCallback, &called, &status));
569 base::RunLoop().RunUntilIdle(); 570 base::RunLoop().RunUntilIdle();
570 571
571 EXPECT_TRUE(called); 572 EXPECT_TRUE(called);
572 EXPECT_EQ(SERVICE_WORKER_OK, status); 573 EXPECT_EQ(SERVICE_WORKER_OK, status);
573 574
574 EXPECT_TRUE(context()->GetProviderHost(process_id, kProviderId)); 575 EXPECT_TRUE(context()->GetProviderHost(process_id, kProviderId));
575 EXPECT_EQ(ServiceWorkerVersion::RUNNING, version->running_status()); 576 EXPECT_EQ(ServiceWorkerVersion::RUNNING, version->running_status());
576 577
577 // Simulate the render process crashing. 578 // Simulate the render process crashing.
578 dispatcher_host_->OnFilterRemoved(); 579 dispatcher_host_->OnFilterRemoved();
(...skipping 11 matching lines...) Expand all
590 591
591 // To show the new dispatcher can operate, simulate provider creation. Since 592 // To show the new dispatcher can operate, simulate provider creation. Since
592 // the old dispatcher cleaned up the old provider host, the new one won't 593 // the old dispatcher cleaned up the old provider host, the new one won't
593 // complain. 594 // complain.
594 new_dispatcher_host->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated( 595 new_dispatcher_host->OnMessageReceived(ServiceWorkerHostMsg_ProviderCreated(
595 kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW)); 596 kProviderId, MSG_ROUTING_NONE, SERVICE_WORKER_PROVIDER_FOR_WINDOW));
596 EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_); 597 EXPECT_EQ(0, new_dispatcher_host->bad_messages_received_count_);
597 } 598 }
598 599
599 } // namespace content 600 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698