| 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/local_discovery/privet_local_printer_lister.h" | 5 #include "chrome/browser/local_discovery/privet_local_printer_lister.h" |
| 6 | 6 |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/thread_task_runner_handle.h" |
| 8 #include "chrome/browser/local_discovery/test_service_discovery_client.h" | 9 #include "chrome/browser/local_discovery/test_service_discovery_client.h" |
| 9 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
| 10 #include "net/url_request/test_url_fetcher_factory.h" | 11 #include "net/url_request/test_url_fetcher_factory.h" |
| 11 #include "net/url_request/url_request_test_util.h" | 12 #include "net/url_request/url_request_test_util.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 15 |
| 15 using testing::StrictMock; | 16 using testing::StrictMock; |
| 16 using testing::AtLeast; | 17 using testing::AtLeast; |
| 17 using testing::_; | 18 using testing::_; |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 103 |
| 103 MOCK_METHOD0(LocalPrinterCacheFlushed, void()); | 104 MOCK_METHOD0(LocalPrinterCacheFlushed, void()); |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 class PrivetLocalPrinterListerTest : public testing::Test { | 107 class PrivetLocalPrinterListerTest : public testing::Test { |
| 107 public: | 108 public: |
| 108 PrivetLocalPrinterListerTest() { | 109 PrivetLocalPrinterListerTest() { |
| 109 test_service_discovery_client_ = new TestServiceDiscoveryClient(); | 110 test_service_discovery_client_ = new TestServiceDiscoveryClient(); |
| 110 test_service_discovery_client_->Start(); | 111 test_service_discovery_client_->Start(); |
| 111 url_request_context_ = new net::TestURLRequestContextGetter( | 112 url_request_context_ = new net::TestURLRequestContextGetter( |
| 112 base::MessageLoopProxy::current()); | 113 base::ThreadTaskRunnerHandle::Get()); |
| 113 local_printer_lister_.reset(new PrivetLocalPrinterLister( | 114 local_printer_lister_.reset(new PrivetLocalPrinterLister( |
| 114 test_service_discovery_client_.get(), | 115 test_service_discovery_client_.get(), |
| 115 url_request_context_.get(), | 116 url_request_context_.get(), |
| 116 &delegate_)); | 117 &delegate_)); |
| 117 } | 118 } |
| 118 | 119 |
| 119 ~PrivetLocalPrinterListerTest() { | 120 ~PrivetLocalPrinterListerTest() { |
| 120 } | 121 } |
| 121 | 122 |
| 122 bool SuccessfulResponseToURL(const GURL& url, | 123 bool SuccessfulResponseToURL(const GURL& url, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 EXPECT_CALL(delegate_, LocalPrinterChanged(true, kServiceName, false, _)); | 180 EXPECT_CALL(delegate_, LocalPrinterChanged(true, kServiceName, false, _)); |
| 180 | 181 |
| 181 EXPECT_TRUE(SuccessfulResponseToURL( | 182 EXPECT_TRUE(SuccessfulResponseToURL( |
| 182 GURL(kPrivetInfoURL), | 183 GURL(kPrivetInfoURL), |
| 183 std::string(kInfoIsNotLocalPrinter))); | 184 std::string(kInfoIsNotLocalPrinter))); |
| 184 }; | 185 }; |
| 185 | 186 |
| 186 } // namespace | 187 } // namespace |
| 187 | 188 |
| 188 } // namespace local_discovery | 189 } // namespace local_discovery |
| OLD | NEW |