| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | 7 namespace extensions { |
| 8 #include "chrome/common/chrome_switches.h" | |
| 9 | 8 |
| 10 using extensions::Extension; | 9 using DeveloperPrivateApiTest = ExtensionApiTest; |
| 11 using extensions::Manifest; | |
| 12 | |
| 13 class DeveloperPrivateApiTest : public ExtensionApiTest { | |
| 14 public: | |
| 15 virtual void LoadExtensions() { | |
| 16 base::FilePath base_dir = test_data_dir_.AppendASCII("developer"); | |
| 17 LoadNamedExtension(base_dir, "hosted_app"); | |
| 18 } | |
| 19 | |
| 20 protected: | |
| 21 void LoadNamedExtension(const base::FilePath& path, | |
| 22 const std::string& name) { | |
| 23 const Extension* extension = LoadExtension(path.AppendASCII(name)); | |
| 24 ASSERT_TRUE(extension); | |
| 25 extension_name_to_ids_[name] = extension->id(); | |
| 26 } | |
| 27 | |
| 28 void InstallNamedExtension(const base::FilePath& path, | |
| 29 const std::string& name, | |
| 30 Manifest::Location install_source) { | |
| 31 const Extension* extension = InstallExtension(path.AppendASCII(name), 1, | |
| 32 install_source); | |
| 33 ASSERT_TRUE(extension); | |
| 34 extension_name_to_ids_[name] = extension->id(); | |
| 35 } | |
| 36 | |
| 37 std::map<std::string, std::string> extension_name_to_ids_; | |
| 38 }; | |
| 39 | 10 |
| 40 IN_PROC_BROWSER_TEST_F(DeveloperPrivateApiTest, Basics) { | 11 IN_PROC_BROWSER_TEST_F(DeveloperPrivateApiTest, Basics) { |
| 41 LoadExtensions(); | 12 // Load up some extensions so that we can query their info and adjust their |
| 42 | 13 // setings in the API test. |
| 43 base::FilePath basedir = test_data_dir_.AppendASCII("developer"); | 14 base::FilePath base_dir = test_data_dir_.AppendASCII("developer"); |
| 44 InstallNamedExtension(basedir, "packaged_app", Manifest::INTERNAL); | 15 EXPECT_TRUE(LoadExtension(base_dir.AppendASCII("hosted_app"))); |
| 45 | 16 EXPECT_TRUE(InstallExtension( |
| 46 InstallNamedExtension(basedir, "simple_extension", Manifest::INTERNAL); | 17 base_dir.AppendASCII("packaged_app"), 1, Manifest::INTERNAL)); |
| 18 LoadExtension(base_dir.AppendASCII("simple_extension")); |
| 47 | 19 |
| 48 ASSERT_TRUE(RunPlatformAppTestWithFlags( | 20 ASSERT_TRUE(RunPlatformAppTestWithFlags( |
| 49 "developer/test", kFlagLoadAsComponent)); | 21 "developer/test", kFlagLoadAsComponent)); |
| 50 } | 22 } |
| 23 |
| 24 } // namespace extensions |
| OLD | NEW |