| 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chrome/common/local_discovery/service_discovery_client.h" | 10 #include "chrome/common/local_discovery/service_discovery_client.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 @end | 39 @end |
| 40 | 40 |
| 41 namespace local_discovery { | 41 namespace local_discovery { |
| 42 | 42 |
| 43 class ServiceDiscoveryClientMacTest : public CocoaTest { | 43 class ServiceDiscoveryClientMacTest : public CocoaTest { |
| 44 public: | 44 public: |
| 45 ServiceDiscoveryClientMacTest() : num_updates_(0), num_resolves_(0) { | 45 ServiceDiscoveryClientMacTest() : num_updates_(0), num_resolves_(0) { |
| 46 client_mac_ = new ServiceDiscoveryClientMac(); | 46 client_mac_ = new ServiceDiscoveryClientMac(); |
| 47 client_ = client_mac_; | 47 client_ = client_mac_.get(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void OnServiceUpdated( | 50 void OnServiceUpdated( |
| 51 ServiceWatcher::UpdateType update, | 51 ServiceWatcher::UpdateType update, |
| 52 const std::string& service_name) { | 52 const std::string& service_name) { |
| 53 last_update_ = update; | 53 last_update_ = update; |
| 54 last_service_name_ = service_name; | 54 last_service_name_ = service_name; |
| 55 num_updates_++; | 55 num_updates_++; |
| 56 } | 56 } |
| 57 | 57 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 resolver_impl->GetContainerForTesting()->OnResolveUpdate( | 122 resolver_impl->GetContainerForTesting()->OnResolveUpdate( |
| 123 ServiceResolver::STATUS_SUCCESS); | 123 ServiceResolver::STATUS_SUCCESS); |
| 124 | 124 |
| 125 base::MessageLoop::current()->RunUntilIdle(); | 125 base::MessageLoop::current()->RunUntilIdle(); |
| 126 | 126 |
| 127 EXPECT_EQ(1, num_resolves_); | 127 EXPECT_EQ(1, num_resolves_); |
| 128 EXPECT_EQ(2u, last_service_description_.metadata.size()); | 128 EXPECT_EQ(2u, last_service_description_.metadata.size()); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace local_discovery | 131 } // namespace local_discovery |
| OLD | NEW |