| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <map> | |
| 6 | |
| 7 #include "chrome/browser/extensions/extension_apitest.h" | |
| 8 #include "chrome/common/chrome_switches.h" | |
| 9 | |
| 10 using extensions::Extension; | |
| 11 using extensions::Manifest; | |
| 12 | |
| 13 class DeveloperPrivateApiTest : public ExtensionApiTest { | |
| 14 public: | |
| 15 virtual void SetUpCommandLine(CommandLine* command_line) { | |
| 16 ExtensionApiTest::SetUpCommandLine(command_line); | |
| 17 command_line->AppendSwitch(switches::kAppsDebugger); | |
| 18 } | |
| 19 | |
| 20 virtual void LoadExtensions() { | |
| 21 FilePath base_dir = test_data_dir_.AppendASCII("developer"); | |
| 22 LoadNamedExtension(base_dir, "hosted_app"); | |
| 23 } | |
| 24 | |
| 25 protected: | |
| 26 void LoadNamedExtension(const FilePath& path, | |
| 27 const std::string& name) { | |
| 28 const Extension* extension = LoadExtension(path.AppendASCII(name)); | |
| 29 ASSERT_TRUE(extension); | |
| 30 extension_name_to_ids_[name] = extension->id(); | |
| 31 } | |
| 32 | |
| 33 void InstallNamedExtension(const FilePath& path, | |
| 34 const std::string& name, | |
| 35 Extension::Location install_source) { | |
| 36 const Extension* extension = InstallExtension(path.AppendASCII(name), 1, | |
| 37 install_source); | |
| 38 ASSERT_TRUE(extension); | |
| 39 extension_name_to_ids_[name] = extension->id(); | |
| 40 } | |
| 41 | |
| 42 std::map<std::string, std::string> extension_name_to_ids_; | |
| 43 }; | |
| 44 | |
| 45 IN_PROC_BROWSER_TEST_F(DeveloperPrivateApiTest, Basics) { | |
| 46 LoadExtensions(); | |
| 47 | |
| 48 FilePath basedir = test_data_dir_.AppendASCII("developer"); | |
| 49 InstallNamedExtension(basedir, "packaged_app", Extension::INTERNAL); | |
| 50 | |
| 51 InstallNamedExtension(basedir, "simple_extension", Extension::INTERNAL); | |
| 52 | |
| 53 ASSERT_TRUE(RunExtensionSubtest( | |
| 54 "developer/test", "basics.html", kFlagLoadAsComponent)); | |
| 55 } | |
| OLD | NEW |