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

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

Issue 2689693003: Add a helper method to create SW SimpleEventCallbacks. (Closed)
Patch Set: Add a helper method to create SW SimpleEventCallbacks. Created 3 years, 10 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
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <tuple> 8 #include <tuple>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 907
908 // Create a request. 908 // Create a request.
909 int request_id = 909 int request_id =
910 version_->StartRequest(ServiceWorkerMetrics::EventType::FETCH_MAIN_FRAME, 910 version_->StartRequest(ServiceWorkerMetrics::EventType::FETCH_MAIN_FRAME,
911 CreateReceiverOnCurrentThread(&error_status)); 911 CreateReceiverOnCurrentThread(&error_status));
912 912
913 // Dispatch a dummy event whose response will be received by SWVersion. 913 // Dispatch a dummy event whose response will be received by SWVersion.
914 EXPECT_FALSE(extendable_message_event_callback()); 914 EXPECT_FALSE(extendable_message_event_callback());
915 version_->event_dispatcher()->DispatchExtendableMessageEvent( 915 version_->event_dispatcher()->DispatchExtendableMessageEvent(
916 mojom::ExtendableMessageEvent::New(), 916 mojom::ExtendableMessageEvent::New(),
917 base::Bind(&ServiceWorkerVersion::OnSimpleEventFinished, version_, 917 version_->CreateSimpleEventCallback(request_id));
918 request_id)); 918
919 base::RunLoop().RunUntilIdle(); 919 base::RunLoop().RunUntilIdle();
920 // The renderer should have received an ExtendableMessageEvent request. 920 // The renderer should have received an ExtendableMessageEvent request.
921 EXPECT_TRUE(extendable_message_event_callback()); 921 EXPECT_TRUE(extendable_message_event_callback());
922 922
923 // Callback has not completed yet. 923 // Callback has not completed yet.
924 EXPECT_EQ(SERVICE_WORKER_ERROR_NETWORK, error_status); 924 EXPECT_EQ(SERVICE_WORKER_ERROR_NETWORK, error_status);
925 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, version_->running_status()); 925 EXPECT_EQ(EmbeddedWorkerStatus::RUNNING, version_->running_status());
926 926
927 // Simulate timeout. 927 // Simulate timeout.
928 EXPECT_FALSE(stop_worker_callback()); 928 EXPECT_FALSE(stop_worker_callback());
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); 1855 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1);
1856 histogram_tester_.ExpectTotalCount(kLinkTapDown, 0); 1856 histogram_tester_.ExpectTotalCount(kLinkTapDown, 0);
1857 EXPECT_EQ(SERVICE_WORKER_OK, status); 1857 EXPECT_EQ(SERVICE_WORKER_OK, status);
1858 StopWorker(); 1858 StopWorker();
1859 // The UMA for kLinkMouseDown must be recorded when the worker stopped. 1859 // The UMA for kLinkMouseDown must be recorded when the worker stopped.
1860 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1); 1860 histogram_tester_.ExpectTotalCount(kLinkMouseDown, 1);
1861 histogram_tester_.ExpectTotalCount(kLinkTapDown, 1); 1861 histogram_tester_.ExpectTotalCount(kLinkTapDown, 1);
1862 } 1862 }
1863 1863
1864 } // namespace content 1864 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698