| 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 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 
| 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 
| 7 | 7 | 
|  | 8 #include <string> | 
| 8 #include <vector> | 9 #include <vector> | 
| 9 | 10 | 
| 10 #include "base/macros.h" | 11 #include "base/macros.h" | 
| 11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" | 
| 12 | 13 | 
| 13 namespace arc { | 14 namespace arc { | 
| 14 class AppInfo; | 15 class AppInfo; | 
| 15 class FakeArcBridgeService; | 16 class FakeArcBridgeService; | 
| 16 class FakeAppInstance; | 17 class FakeAppInstance; | 
| 17 } | 18 } | 
| 18 | 19 | 
| 19 namespace content { | 20 namespace content { | 
| 20 class BrowserContext; | 21 class BrowserContext; | 
| 21 } | 22 } | 
| 22 | 23 | 
| 23 // Helper class to initialize arc bridge to work with arc apps in unit tests. | 24 // Helper class to initialize arc bridge to work with arc apps in unit tests. | 
| 24 class ArcAppTest { | 25 class ArcAppTest { | 
| 25  public: | 26  public: | 
| 26   ArcAppTest(); | 27   ArcAppTest(); | 
| 27   virtual ~ArcAppTest(); | 28   virtual ~ArcAppTest(); | 
| 28 | 29 | 
| 29   void SetUp(content::BrowserContext* browser_context); | 30   void SetUp(content::BrowserContext* browser_context); | 
| 30 | 31 | 
| 31   static std::string GetAppId(const arc::AppInfo& app_info); | 32   static std::string GetAppId(const arc::AppInfo& app_info); | 
| 32 | 33 | 
|  | 34   // The 0th item is sticky but not the followings. | 
| 33   const std::vector<arc::AppInfo>& fake_apps() const { return fake_apps_; } | 35   const std::vector<arc::AppInfo>& fake_apps() const { return fake_apps_; } | 
| 34 | 36 | 
| 35   arc::FakeArcBridgeService* bridge_service() { return bridge_service_.get(); } | 37   arc::FakeArcBridgeService* bridge_service() { return bridge_service_.get(); } | 
| 36 | 38 | 
| 37   arc::FakeAppInstance* app_instance() { return app_instance_.get(); } | 39   arc::FakeAppInstance* app_instance() { return app_instance_.get(); } | 
| 38 | 40 | 
| 39  private: | 41  private: | 
| 40   // Unowned pointer. | 42   // Unowned pointer. | 
| 41   content::BrowserContext* browser_context_ = nullptr; | 43   content::BrowserContext* browser_context_ = nullptr; | 
| 42 | 44 | 
| 43   scoped_ptr<arc::FakeArcBridgeService> bridge_service_; | 45   scoped_ptr<arc::FakeArcBridgeService> bridge_service_; | 
| 44   scoped_ptr<arc::FakeAppInstance> app_instance_; | 46   scoped_ptr<arc::FakeAppInstance> app_instance_; | 
| 45   std::vector<arc::AppInfo> fake_apps_; | 47   std::vector<arc::AppInfo> fake_apps_; | 
| 46 | 48 | 
| 47   DISALLOW_COPY_AND_ASSIGN(ArcAppTest); | 49   DISALLOW_COPY_AND_ASSIGN(ArcAppTest); | 
| 48 }; | 50 }; | 
| 49 | 51 | 
| 50 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 52 #endif  // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_APP_TEST_H_ | 
| 51 |  | 
| OLD | NEW | 
|---|