OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "headless/public/util/deterministic_dispatcher.h" | 5 #include "headless/public/util/deterministic_dispatcher.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 base::RunLoop().RunUntilIdle(); | 103 base::RunLoop().RunUntilIdle(); |
104 EXPECT_THAT(notifications, | 104 EXPECT_THAT(notifications, |
105 ElementsAre("id: 1 OK", "id: 2 OK", "id: 3 err: -123")); | 105 ElementsAre("id: 1 OK", "id: 2 OK", "id: 3 err: -123")); |
106 | 106 |
107 job3.reset(); | 107 job3.reset(); |
108 base::RunLoop().RunUntilIdle(); | 108 base::RunLoop().RunUntilIdle(); |
109 EXPECT_THAT(notifications, ElementsAre("id: 1 OK", "id: 2 OK", | 109 EXPECT_THAT(notifications, ElementsAre("id: 1 OK", "id: 2 OK", |
110 "id: 3 err: -123", "id: 4 OK")); | 110 "id: 3 err: -123", "id: 4 OK")); |
111 } | 111 } |
112 | 112 |
| 113 TEST_F(DeterministicDispatcherTest, JobKilled) { |
| 114 std::vector<std::string> notifications; |
| 115 { |
| 116 std::unique_ptr<FakeManagedDispatchURLRequestJob> job( |
| 117 new FakeManagedDispatchURLRequestJob(deterministic_dispatcher_.get(), 1, |
| 118 ¬ifications)); |
| 119 |
| 120 job->Kill(); |
| 121 } |
| 122 |
| 123 EXPECT_TRUE(notifications.empty()); |
| 124 |
| 125 base::RunLoop().RunUntilIdle(); |
| 126 EXPECT_TRUE(notifications.empty()); |
| 127 } |
| 128 |
113 } // namespace headless | 129 } // namespace headless |
OLD | NEW |