| 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 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // testing::Test | 88 // testing::Test |
| 89 void SetUp() override; | 89 void SetUp() override; |
| 90 void TearDown() override; | 90 void TearDown() override; |
| 91 | 91 |
| 92 protected: | 92 protected: |
| 93 TestPhysicalWebDataSource data_source_; | 93 TestPhysicalWebDataSource data_source_; |
| 94 TestPhysicalWebListener listener_; | 94 TestPhysicalWebListener listener_; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 void PhysicalWebDataSourceImplTest::SetUp() { | 97 void PhysicalWebDataSourceImplTest::SetUp() { |
| 98 data_source_.RegisterListener(&listener_); | 98 data_source_.RegisterListener(&listener_, physical_web::OPPORTUNISTIC); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void PhysicalWebDataSourceImplTest::TearDown() { | 101 void PhysicalWebDataSourceImplTest::TearDown() { |
| 102 data_source_.UnregisterListener(&listener_); | 102 data_source_.UnregisterListener(&listener_); |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Tests ---------------------------------------------------------------------- | 105 // Tests ---------------------------------------------------------------------- |
| 106 | 106 |
| 107 TEST_F(PhysicalWebDataSourceImplTest, OnFound) { | 107 TEST_F(PhysicalWebDataSourceImplTest, OnFound) { |
| 108 data_source_.NotifyOnFound(kUrl); | 108 data_source_.NotifyOnFound(kUrl); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 TEST_F(PhysicalWebDataSourceImplTest, OnDistanceChangedNotRegistered) { | 149 TEST_F(PhysicalWebDataSourceImplTest, OnDistanceChangedNotRegistered) { |
| 150 data_source_.UnregisterListener(&listener_); | 150 data_source_.UnregisterListener(&listener_); |
| 151 data_source_.NotifyOnDistanceChanged(kUrl, 0.0); | 151 data_source_.NotifyOnDistanceChanged(kUrl, 0.0); |
| 152 EXPECT_FALSE(listener_.OnFoundNotified()); | 152 EXPECT_FALSE(listener_.OnFoundNotified()); |
| 153 EXPECT_FALSE(listener_.OnLostNotified()); | 153 EXPECT_FALSE(listener_.OnLostNotified()); |
| 154 EXPECT_FALSE(listener_.OnDistanceChangedNotified()); | 154 EXPECT_FALSE(listener_.OnDistanceChangedNotified()); |
| 155 EXPECT_TRUE(listener_.LastEventUrl().is_empty()); | 155 EXPECT_TRUE(listener_.LastEventUrl().is_empty()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace physical_web | 158 } // namespace physical_web |
| OLD | NEW |