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

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

Issue 2655233007: Get rid of RefCounted for ActivityIconLoader. (Closed)
Patch Set: address comments Created 3 years, 10 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
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"
11 #include "components/arc/common/intent_helper.mojom.h" 11 #include "components/arc/common/intent_helper.mojom.h"
12 #include "components/arc/intent_helper/activity_icon_loader.h"
13 #include "components/arc/intent_helper/local_activity_resolver.h" 12 #include "components/arc/intent_helper/local_activity_resolver.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 14
16 namespace arc { 15 namespace arc {
17 16
18 namespace { 17 namespace {
19 18
20 class ArcIntentHelperTest : public testing::Test { 19 class ArcIntentHelperTest : public testing::Test {
21 public: 20 public:
22 ArcIntentHelperTest() = default; 21 ArcIntentHelperTest() = default;
23 22
24 protected: 23 protected:
25 std::unique_ptr<ArcBridgeService> arc_bridge_service_; 24 std::unique_ptr<ArcBridgeService> arc_bridge_service_;
26 scoped_refptr<ActivityIconLoader> icon_loader_;
27 scoped_refptr<LocalActivityResolver> activity_resolver_; 25 scoped_refptr<LocalActivityResolver> activity_resolver_;
28 std::unique_ptr<ArcIntentHelperBridge> instance_; 26 std::unique_ptr<ArcIntentHelperBridge> instance_;
29 27
30 private: 28 private:
31 void SetUp() override { 29 void SetUp() override {
32 arc_bridge_service_ = base::MakeUnique<ArcBridgeService>(); 30 arc_bridge_service_ = base::MakeUnique<ArcBridgeService>();
33 icon_loader_ = new ActivityIconLoader();
34 activity_resolver_ = new LocalActivityResolver(); 31 activity_resolver_ = new LocalActivityResolver();
35 instance_ = base::MakeUnique<ArcIntentHelperBridge>( 32 instance_ = base::MakeUnique<ArcIntentHelperBridge>(
36 arc_bridge_service_.get(), icon_loader_, activity_resolver_); 33 arc_bridge_service_.get(), activity_resolver_);
37 } 34 }
38 35
39 void TearDown() override { 36 void TearDown() override {
40 instance_.reset(); 37 instance_.reset();
41 activity_resolver_ = nullptr; 38 activity_resolver_ = nullptr;
42 icon_loader_ = nullptr;
43 arc_bridge_service_.reset(); 39 arc_bridge_service_.reset();
44 } 40 }
45 41
46 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperTest); 42 DISALLOW_COPY_AND_ASSIGN(ArcIntentHelperTest);
47 }; 43 };
48 44
49 } // namespace 45 } // namespace
50 46
51 // Tests if IsIntentHelperPackage works as expected. Probably too trivial 47 // Tests if IsIntentHelperPackage works as expected. Probably too trivial
52 // to test but just in case. 48 // to test but just in case.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 EXPECT_TRUE(observer->IsUpdated()); 155 EXPECT_TRUE(observer->IsUpdated());
160 156
161 // Observer should not be called after it's removed. 157 // Observer should not be called after it's removed.
162 observer->Reset(); 158 observer->Reset();
163 instance_->RemoveObserver(observer.get()); 159 instance_->RemoveObserver(observer.get());
164 instance_->OnIntentFiltersUpdated(std::vector<IntentFilter>()); 160 instance_->OnIntentFiltersUpdated(std::vector<IntentFilter>());
165 EXPECT_FALSE(observer->IsUpdated()); 161 EXPECT_FALSE(observer->IsUpdated());
166 } 162 }
167 163
168 } // namespace arc 164 } // namespace arc
OLDNEW
« no previous file with comments | « components/arc/intent_helper/arc_intent_helper_bridge.cc ('k') | components/arc/intent_helper/link_handler_model_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698