| 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 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace physical_web { | 11 namespace physical_web { |
| 12 | 12 |
| 13 // Test Values ---------------------------------------------------------------- | 13 // Test Values ---------------------------------------------------------------- |
| 14 const char kUrl[] = "https://www.google.com"; | 14 const char kUrl[] = "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; | 25 std::unique_ptr<base::ListValue> GetMetadata() override; |
| 26 std::unique_ptr<MetadataList> GetMetadataList() override; |
| 26 bool HasUnresolvedDiscoveries() override; | 27 bool HasUnresolvedDiscoveries() override; |
| 27 }; | 28 }; |
| 28 void TestPhysicalWebDataSource::StartDiscovery(bool network_request_enabled) {} | 29 void TestPhysicalWebDataSource::StartDiscovery(bool network_request_enabled) {} |
| 29 | 30 |
| 30 void TestPhysicalWebDataSource::StopDiscovery() {} | 31 void TestPhysicalWebDataSource::StopDiscovery() {} |
| 31 | 32 |
| 32 std::unique_ptr<base::ListValue> TestPhysicalWebDataSource::GetMetadata() { | 33 std::unique_ptr<base::ListValue> TestPhysicalWebDataSource::GetMetadata() { |
| 33 return NULL; | 34 return NULL; |
| 34 } | 35 } |
| 35 | 36 |
| 37 std::unique_ptr<MetadataList> TestPhysicalWebDataSource::GetMetadataList() { |
| 38 return NULL; |
| 39 } |
| 40 |
| 36 bool TestPhysicalWebDataSource::HasUnresolvedDiscoveries() { | 41 bool TestPhysicalWebDataSource::HasUnresolvedDiscoveries() { |
| 37 return false; | 42 return false; |
| 38 } | 43 } |
| 39 | 44 |
| 40 // TestPhysicalWebListener ---------------------------------------------------- | 45 // TestPhysicalWebListener ---------------------------------------------------- |
| 41 | 46 |
| 42 class TestPhysicalWebListener : public PhysicalWebListener { | 47 class TestPhysicalWebListener : public PhysicalWebListener { |
| 43 public: | 48 public: |
| 44 TestPhysicalWebListener() | 49 TestPhysicalWebListener() |
| 45 : on_found_notified_(false), | 50 : on_found_notified_(false), |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 TEST_F(PhysicalWebDataSourceImplTest, OnDistanceChangedNotRegistered) { | 155 TEST_F(PhysicalWebDataSourceImplTest, OnDistanceChangedNotRegistered) { |
| 151 data_source_.UnregisterListener(&listener_); | 156 data_source_.UnregisterListener(&listener_); |
| 152 data_source_.NotifyOnDistanceChanged(kUrl, 0.0); | 157 data_source_.NotifyOnDistanceChanged(kUrl, 0.0); |
| 153 EXPECT_FALSE(listener_.OnFoundNotified()); | 158 EXPECT_FALSE(listener_.OnFoundNotified()); |
| 154 EXPECT_FALSE(listener_.OnLostNotified()); | 159 EXPECT_FALSE(listener_.OnLostNotified()); |
| 155 EXPECT_FALSE(listener_.OnDistanceChangedNotified()); | 160 EXPECT_FALSE(listener_.OnDistanceChangedNotified()); |
| 156 EXPECT_TRUE(listener_.LastEventUrl().empty()); | 161 EXPECT_TRUE(listener_.LastEventUrl().empty()); |
| 157 } | 162 } |
| 158 | 163 |
| 159 } // namespace physical_web | 164 } // namespace physical_web |
| OLD | NEW |