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

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

Issue 2061203002: WIP Reland: service worker: Don't control a subframe of an insecure context Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: maybe fix drmemory Created 4 years, 6 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 "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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 EXPECT_EQ(SERVICE_WORKER_OK, status); 614 EXPECT_EQ(SERVICE_WORKER_OK, status);
615 EXPECT_TRUE(version_->timeout_timer_.IsRunning()); 615 EXPECT_TRUE(version_->timeout_timer_.IsRunning());
616 EXPECT_LT(idle_time, version_->idle_time_); 616 EXPECT_LT(idle_time, version_->idle_time_);
617 617
618 // Adding a controllee resets the idle time. 618 // Adding a controllee resets the idle time.
619 version_->idle_time_ -= kOneSecond; 619 version_->idle_time_ -= kOneSecond;
620 idle_time = version_->idle_time_; 620 idle_time = version_->idle_time_;
621 std::unique_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost( 621 std::unique_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost(
622 33 /* dummy render process id */, MSG_ROUTING_NONE /* render_frame_id */, 622 33 /* dummy render process id */, MSG_ROUTING_NONE /* render_frame_id */,
623 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW, 623 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
624 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
624 helper_->context()->AsWeakPtr(), NULL)); 625 helper_->context()->AsWeakPtr(), NULL));
625 version_->AddControllee(host.get()); 626 version_->AddControllee(host.get());
626 EXPECT_TRUE(version_->timeout_timer_.IsRunning()); 627 EXPECT_TRUE(version_->timeout_timer_.IsRunning());
627 EXPECT_LT(idle_time, version_->idle_time_); 628 EXPECT_LT(idle_time, version_->idle_time_);
628 629
629 // Completing an event resets the idle time. 630 // Completing an event resets the idle time.
630 version_->idle_time_ -= kOneSecond; 631 version_->idle_time_ -= kOneSecond;
631 idle_time = version_->idle_time_; 632 idle_time = version_->idle_time_;
632 SimulateDispatchEvent(ServiceWorkerMetrics::EventType::FETCH_MAIN_FRAME); 633 SimulateDispatchEvent(ServiceWorkerMetrics::EventType::FETCH_MAIN_FRAME);
633 EXPECT_LT(idle_time, version_->idle_time_); 634 EXPECT_LT(idle_time, version_->idle_time_);
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 helper_->SimulateSendSimpleEventResult( 1463 helper_->SimulateSendSimpleEventResult(
1463 version_->embedded_worker()->embedded_worker_id(), request_id, 1464 version_->embedded_worker()->embedded_worker_id(), request_id,
1464 blink::WebServiceWorkerEventResultRejected); 1465 blink::WebServiceWorkerEventResultRejected);
1465 runner->Run(); 1466 runner->Run();
1466 1467
1467 // Verify callback was called with correct status. 1468 // Verify callback was called with correct status.
1468 EXPECT_EQ(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, status); 1469 EXPECT_EQ(SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED, status);
1469 } 1470 }
1470 1471
1471 } // namespace content 1472 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698