| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/net/dns_probe_runner.h" | 5 #include "chrome/browser/net/dns_probe_runner.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 EXPECT_FALSE(called_); | 41 EXPECT_FALSE(called_); |
| 42 called_ = true; | 42 called_ = true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 base::Closure callback_; | 45 base::Closure callback_; |
| 46 bool called_; | 46 bool called_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class DnsProbeRunnerTest : public testing::Test { | 49 class DnsProbeRunnerTest : public testing::Test { |
| 50 protected: | 50 protected: |
| 51 void RunTest(MockDnsClientRule::Result query_result, | 51 void RunTest(MockDnsClientRule::ResultType query_result, |
| 52 DnsProbeRunner::Result expected_probe_result); | 52 DnsProbeRunner::Result expected_probe_result); |
| 53 | 53 |
| 54 TestBrowserThreadBundle bundle_; | 54 TestBrowserThreadBundle bundle_; |
| 55 DnsProbeRunner runner_; | 55 DnsProbeRunner runner_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 void DnsProbeRunnerTest::RunTest( | 58 void DnsProbeRunnerTest::RunTest( |
| 59 MockDnsClientRule::Result query_result, | 59 MockDnsClientRule::ResultType query_result, |
| 60 DnsProbeRunner::Result expected_probe_result) { | 60 DnsProbeRunner::Result expected_probe_result) { |
| 61 TestDnsProbeRunnerCallback callback; | 61 TestDnsProbeRunnerCallback callback; |
| 62 | 62 |
| 63 runner_.SetClient(CreateMockDnsClientForProbes(query_result)); | 63 runner_.SetClient(CreateMockDnsClientForProbes(query_result)); |
| 64 runner_.RunProbe(callback.callback()); | 64 runner_.RunProbe(callback.callback()); |
| 65 EXPECT_TRUE(runner_.IsRunning()); | 65 EXPECT_TRUE(runner_.IsRunning()); |
| 66 | 66 |
| 67 RunLoop().RunUntilIdle(); | 67 RunLoop().RunUntilIdle(); |
| 68 EXPECT_FALSE(runner_.IsRunning()); | 68 EXPECT_FALSE(runner_.IsRunning()); |
| 69 EXPECT_TRUE(callback.called()); | 69 EXPECT_TRUE(callback.called()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 RunLoop().RunUntilIdle(); | 106 RunLoop().RunUntilIdle(); |
| 107 EXPECT_FALSE(runner_.IsRunning()); | 107 EXPECT_FALSE(runner_.IsRunning()); |
| 108 EXPECT_TRUE(callback.called()); | 108 EXPECT_TRUE(callback.called()); |
| 109 EXPECT_EQ(DnsProbeRunner::UNKNOWN, runner_.result()); | 109 EXPECT_EQ(DnsProbeRunner::UNKNOWN, runner_.result()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 } // namespace | 112 } // namespace |
| 113 | 113 |
| 114 } // namespace chrome_browser_net | 114 } // namespace chrome_browser_net |
| OLD | NEW |