Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(646)

Side by Side Diff: components/physical_web/data_source/physical_web_data_source_impl_unittest.cc

Issue 2765713002: Associate a scan mode with Physical Web listeners (Closed)
Patch Set: Use key as parame to erase() Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/physical_web/data_source/physical_web_data_source_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/physical_web/data_source/physical_web_data_source_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698