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

Unified Diff: go/src/infra/libs/clock/testclock/testclock_test.go

Issue 1223213002: Remove libs/clock in favor of luci-go/common/clock. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@abstract
Patch Set: rebase Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: go/src/infra/libs/clock/testclock/testclock_test.go
diff --git a/go/src/infra/libs/clock/testclock/testclock_test.go b/go/src/infra/libs/clock/testclock/testclock_test.go
deleted file mode 100644
index 5fae355ada75b62c39d68a25f20e7eae54800470..0000000000000000000000000000000000000000
--- a/go/src/infra/libs/clock/testclock/testclock_test.go
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2015 The Chromium 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 testclock
-
-import (
- "testing"
- "time"
-
- . "github.com/smartystreets/goconvey/convey"
- "infra/libs/clock"
-)
-
-func TestTestClock(t *testing.T) {
- t.Parallel()
-
- Convey(`A testing clock instance`, t, func() {
- now := time.Date(2015, 01, 01, 00, 00, 00, 00, time.UTC)
- c := New(now)
-
- Convey(`Returns the current time.`, func() {
- So(c.Now(), ShouldResemble, now)
- })
-
- Convey(`When sleeping with a time of zero, immediately awakens.`, func() {
- c.Sleep(0)
- So(c.Now(), ShouldResemble, now)
- })
-
- Convey(`When sleeping for a period of time, awakens when signalled.`, func() {
- sleepingC := make(chan struct{})
- c.SetTimerCallback(func(_ clock.Timer) {
- close(sleepingC)
- })
-
- awakeC := make(chan time.Time)
- go func() {
- c.Sleep(2 * time.Second)
- awakeC <- c.Now()
- }()
-
- <-sleepingC
- c.Set(now.Add(1 * time.Second))
- c.Set(now.Add(2 * time.Second))
- So(<-awakeC, ShouldResemble, now.Add(2*time.Second))
- })
-
- Convey(`Awakens after a period of time.`, func() {
- afterC := c.After(2 * time.Second)
-
- c.Set(now.Add(1 * time.Second))
- c.Set(now.Add(2 * time.Second))
- So(<-afterC, ShouldResemble, now.Add(2*time.Second))
- })
- })
-}
« no previous file with comments | « go/src/infra/libs/clock/testclock/testclock.infra_testing ('k') | go/src/infra/libs/clock/testclock/testtimer.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698