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

Side by Side Diff: components/arc/intent_helper/arc_intent_helper_bridge_unittest.cc

Issue 2579083002: Rename OnAppsUpdated to OnIntentFiltersUpdated (Closed)
Patch Set: address comment 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 "components/arc/intent_helper/arc_intent_helper_bridge.h" 5 #include "components/arc/intent_helper/arc_intent_helper_bridge.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "components/arc/arc_bridge_service.h" 10 #include "components/arc/arc_bridge_service.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 ArcIntentHelperBridge::FilterOutIntentHelper(std::move(orig)); 136 ArcIntentHelperBridge::FilterOutIntentHelper(std::move(orig));
137 EXPECT_EQ(0U, filtered.size()); 137 EXPECT_EQ(0U, filtered.size());
138 } 138 }
139 } 139 }
140 140
141 // Tests if observer works as expected. 141 // Tests if observer works as expected.
142 TEST_F(ArcIntentHelperTest, TestObserver) { 142 TEST_F(ArcIntentHelperTest, TestObserver) {
143 class FakeObserver : public ArcIntentHelperObserver { 143 class FakeObserver : public ArcIntentHelperObserver {
144 public: 144 public:
145 FakeObserver() = default; 145 FakeObserver() = default;
146 void OnAppsUpdated() override { updated_ = true; } 146 void OnIntentFiltersUpdated() override { updated_ = true; }
147 bool IsUpdated() { return updated_; } 147 bool IsUpdated() { return updated_; }
148 void Reset() { updated_ = false; } 148 void Reset() { updated_ = false; }
149 149
150 private: 150 private:
151 bool updated_ = false; 151 bool updated_ = false;
152 }; 152 };
153 153
154 // Observer should be called when intent filter is updated. 154 // Observer should be called when intent filter is updated.
155 auto observer = base::MakeUnique<FakeObserver>(); 155 auto observer = base::MakeUnique<FakeObserver>();
156 instance_->AddObserver(observer.get()); 156 instance_->AddObserver(observer.get());
157 EXPECT_FALSE(observer->IsUpdated()); 157 EXPECT_FALSE(observer->IsUpdated());
158 instance_->OnIntentFiltersUpdated(std::vector<IntentFilter>()); 158 instance_->OnIntentFiltersUpdated(std::vector<IntentFilter>());
159 EXPECT_TRUE(observer->IsUpdated()); 159 EXPECT_TRUE(observer->IsUpdated());
160 160
161 // Observer should not be called after it's removed. 161 // Observer should not be called after it's removed.
162 observer->Reset(); 162 observer->Reset();
163 instance_->RemoveObserver(observer.get()); 163 instance_->RemoveObserver(observer.get());
164 instance_->OnIntentFiltersUpdated(std::vector<IntentFilter>()); 164 instance_->OnIntentFiltersUpdated(std::vector<IntentFilter>());
165 EXPECT_FALSE(observer->IsUpdated()); 165 EXPECT_FALSE(observer->IsUpdated());
166 } 166 }
167 167
168 } // namespace arc 168 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/intent_helper/arc_intent_helper_bridge.cc ('k') | components/arc/intent_helper/arc_intent_helper_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698