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

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

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

Powered by Google App Engine
This is Rietveld 408576698