| 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 "base/values.h" | 5 #include "base/values.h" |
| 6 #include "components/physical_web/data_source/physical_web_data_source_impl.h" | 6 #include "components/physical_web/data_source/physical_web_data_source_impl.h" |
| 7 #include "components/physical_web/data_source/physical_web_listener.h" | 7 #include "components/physical_web/data_source/physical_web_listener.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "url/gurl.h" | 9 #include "url/gurl.h" |
| 10 | 10 |
| 11 namespace physical_web { | 11 namespace physical_web { |
| 12 | 12 |
| 13 // Test Values ---------------------------------------------------------------- | 13 // Test Values ---------------------------------------------------------------- |
| 14 GURL kUrl = GURL("https://www.google.com"); | 14 GURL kUrl = GURL("https://www.google.com"); |
| 15 | 15 |
| 16 // TestPhysicalWebDataSource -------------------------------------------------- | 16 // TestPhysicalWebDataSource -------------------------------------------------- |
| 17 | 17 |
| 18 class TestPhysicalWebDataSource : public PhysicalWebDataSourceImpl { | 18 class TestPhysicalWebDataSource : public PhysicalWebDataSourceImpl { |
| 19 public: | 19 public: |
| 20 TestPhysicalWebDataSource() {} | 20 TestPhysicalWebDataSource() {} |
| 21 ~TestPhysicalWebDataSource() override {} | 21 ~TestPhysicalWebDataSource() override {} |
| 22 | 22 |
| 23 void StartDiscovery(bool network_request_enabled) override; | 23 void StartDiscovery(bool network_request_enabled) override; |
| 24 void StopDiscovery() override; | 24 void StopDiscovery() override; |
| 25 std::unique_ptr<base::ListValue> GetMetadata() override; | |
| 26 std::unique_ptr<MetadataList> GetMetadataList() override; | 25 std::unique_ptr<MetadataList> GetMetadataList() override; |
| 27 bool HasUnresolvedDiscoveries() override; | 26 bool HasUnresolvedDiscoveries() override; |
| 28 }; | 27 }; |
| 29 void TestPhysicalWebDataSource::StartDiscovery(bool network_request_enabled) {} | 28 void TestPhysicalWebDataSource::StartDiscovery(bool network_request_enabled) {} |
| 30 | 29 |
| 31 void TestPhysicalWebDataSource::StopDiscovery() {} | 30 void TestPhysicalWebDataSource::StopDiscovery() {} |
| 32 | 31 |
| 33 std::unique_ptr<base::ListValue> TestPhysicalWebDataSource::GetMetadata() { | |
| 34 return NULL; | |
| 35 } | |
| 36 | |
| 37 std::unique_ptr<MetadataList> TestPhysicalWebDataSource::GetMetadataList() { | 32 std::unique_ptr<MetadataList> TestPhysicalWebDataSource::GetMetadataList() { |
| 38 return NULL; | 33 return NULL; |
| 39 } | 34 } |
| 40 | 35 |
| 41 bool TestPhysicalWebDataSource::HasUnresolvedDiscoveries() { | 36 bool TestPhysicalWebDataSource::HasUnresolvedDiscoveries() { |
| 42 return false; | 37 return false; |
| 43 } | 38 } |
| 44 | 39 |
| 45 // TestPhysicalWebListener ---------------------------------------------------- | 40 // TestPhysicalWebListener ---------------------------------------------------- |
| 46 | 41 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 TEST_F(PhysicalWebDataSourceImplTest, OnDistanceChangedNotRegistered) { | 149 TEST_F(PhysicalWebDataSourceImplTest, OnDistanceChangedNotRegistered) { |
| 155 data_source_.UnregisterListener(&listener_); | 150 data_source_.UnregisterListener(&listener_); |
| 156 data_source_.NotifyOnDistanceChanged(kUrl, 0.0); | 151 data_source_.NotifyOnDistanceChanged(kUrl, 0.0); |
| 157 EXPECT_FALSE(listener_.OnFoundNotified()); | 152 EXPECT_FALSE(listener_.OnFoundNotified()); |
| 158 EXPECT_FALSE(listener_.OnLostNotified()); | 153 EXPECT_FALSE(listener_.OnLostNotified()); |
| 159 EXPECT_FALSE(listener_.OnDistanceChangedNotified()); | 154 EXPECT_FALSE(listener_.OnDistanceChangedNotified()); |
| 160 EXPECT_TRUE(listener_.LastEventUrl().is_empty()); | 155 EXPECT_TRUE(listener_.LastEventUrl().is_empty()); |
| 161 } | 156 } |
| 162 | 157 |
| 163 } // namespace physical_web | 158 } // namespace physical_web |
| OLD | NEW |