mirror of
https://github.com/golang/net.git
synced 2026-03-31 18:37:08 +09:00
Rewrite the synchronization used in Transport tests. This replaces the explicit synchronization, which requires annotating every point where a goroutine in the code under test may block, with implicit syncronization based on parsing goroutine stacks to identify when all goroutines of interest are blocked. Change-Id: I02646e2752c359ed1b08126370a48f3d3c1fde77 Reviewed-on: https://go-review.googlesource.com/c/net/+/584895 Reviewed-by: Jonathan Amsterdam <jba@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
21 lines
515 B
Go
21 lines
515 B
Go
// Copyright 2024 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
package http2
|
|
|
|
import "time"
|
|
|
|
// A timer is a time.Timer, as an interface which can be replaced in tests.
|
|
type timer = interface {
|
|
C() <-chan time.Time
|
|
Reset(d time.Duration) bool
|
|
Stop() bool
|
|
}
|
|
|
|
// timeTimer adapts a time.Timer to the timer interface.
|
|
type timeTimer struct {
|
|
*time.Timer
|
|
}
|
|
|
|
func (t timeTimer) C() <-chan time.Time { return t.Timer.C }
|