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

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

Issue 2561493002: Pass Physical Web metadata through a struct (Closed)
Patch Set: C++ cast afterparty Created 4 years 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
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
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; 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 TEST_F(PhysicalWebDataSourceImplTest, OnDistanceChangedNotRegistered) { 154 TEST_F(PhysicalWebDataSourceImplTest, OnDistanceChangedNotRegistered) {
150 data_source_.UnregisterListener(&listener_); 155 data_source_.UnregisterListener(&listener_);
151 data_source_.NotifyOnDistanceChanged(kUrl, 0.0); 156 data_source_.NotifyOnDistanceChanged(kUrl, 0.0);
152 EXPECT_FALSE(listener_.OnFoundNotified()); 157 EXPECT_FALSE(listener_.OnFoundNotified());
153 EXPECT_FALSE(listener_.OnLostNotified()); 158 EXPECT_FALSE(listener_.OnLostNotified());
154 EXPECT_FALSE(listener_.OnDistanceChangedNotified()); 159 EXPECT_FALSE(listener_.OnDistanceChangedNotified());
155 EXPECT_TRUE(listener_.LastEventUrl().is_empty()); 160 EXPECT_TRUE(listener_.LastEventUrl().is_empty());
156 } 161 }
157 162
158 } // namespace physical_web 163 } // namespace physical_web
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698