| OLD | NEW | 
|---|
| 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 "chrome/browser/ui/app_list/arc/arc_app_test.h" | 5 #include "chrome/browser/ui/app_list/arc/arc_app_test.h" | 
| 6 | 6 | 
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" | 
| 8 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 8 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 
| 9 #include "components/arc/arc_bridge_service.h" | 9 #include "components/arc/arc_bridge_service.h" | 
| 10 #include "components/arc/common/app.mojom.h" | 10 #include "components/arc/common/app.mojom.h" | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 26 void ArcAppTest::SetUp(content::BrowserContext* browser_context) { | 26 void ArcAppTest::SetUp(content::BrowserContext* browser_context) { | 
| 27   DCHECK(!browser_context_); | 27   DCHECK(!browser_context_); | 
| 28   browser_context_ = browser_context; | 28   browser_context_ = browser_context; | 
| 29 | 29 | 
| 30   // Make sure we have enough data for test. | 30   // Make sure we have enough data for test. | 
| 31   for (int i = 0; i < 3; ++i) { | 31   for (int i = 0; i < 3; ++i) { | 
| 32     arc::AppInfo app; | 32     arc::AppInfo app; | 
| 33     app.name = base::StringPrintf("Fake App %d", i); | 33     app.name = base::StringPrintf("Fake App %d", i); | 
| 34     app.package_name = base::StringPrintf("fake.app.%d", i); | 34     app.package_name = base::StringPrintf("fake.app.%d", i); | 
| 35     app.activity = base::StringPrintf("fake.app.%d.activity", i); | 35     app.activity = base::StringPrintf("fake.app.%d.activity", i); | 
|  | 36     app.sticky = false; | 
| 36     fake_apps_.push_back(app); | 37     fake_apps_.push_back(app); | 
| 37   } | 38   } | 
|  | 39   fake_apps_[0].sticky = true; | 
| 38 | 40 | 
| 39   bridge_service_.reset(new arc::FakeArcBridgeService()); | 41   bridge_service_.reset(new arc::FakeArcBridgeService()); | 
| 40   app_instance_.reset( | 42   app_instance_.reset( | 
| 41       new arc::FakeAppInstance(ArcAppListPrefs::Get(browser_context_))); | 43       new arc::FakeAppInstance(ArcAppListPrefs::Get(browser_context_))); | 
| 42   arc::AppInstancePtr instance; | 44   arc::AppInstancePtr instance; | 
| 43   app_instance_->Bind(mojo::GetProxy(&instance)); | 45   app_instance_->Bind(mojo::GetProxy(&instance)); | 
| 44   bridge_service_->OnAppInstanceReady(std::move(instance)); | 46   bridge_service_->OnAppInstanceReady(std::move(instance)); | 
| 45   app_instance_->WaitForOnAppInstanceReady(); | 47   app_instance_->WaitForOnAppInstanceReady(); | 
| 46 | 48 | 
| 47   // Check initial conditions. | 49   // Check initial conditions. | 
| 48   EXPECT_EQ(bridge_service_.get(), arc::ArcBridgeService::Get()); | 50   EXPECT_EQ(bridge_service_.get(), arc::ArcBridgeService::Get()); | 
| 49   EXPECT_TRUE(!arc::ArcBridgeService::Get()->available()); | 51   EXPECT_TRUE(!arc::ArcBridgeService::Get()->available()); | 
| 50   EXPECT_EQ(arc::ArcBridgeService::State::STOPPED, | 52   EXPECT_EQ(arc::ArcBridgeService::State::STOPPED, | 
| 51             arc::ArcBridgeService::Get()->state()); | 53             arc::ArcBridgeService::Get()->state()); | 
| 52 | 54 | 
| 53   // At this point we should have ArcAppListPrefs as observer of service. | 55   // At this point we should have ArcAppListPrefs as observer of service. | 
| 54   EXPECT_TRUE(bridge_service_->HasObserver(ArcAppListPrefs::Get( | 56   EXPECT_TRUE(bridge_service_->HasObserver(ArcAppListPrefs::Get( | 
| 55       browser_context_))); | 57       browser_context_))); | 
| 56 } | 58 } | 
| OLD | NEW | 
|---|