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.
7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/common/chrome_switches.h"
10 using extensions::Extension;
11 using extensions::Manifest;
13 class DeveloperPrivateApiTest : public ExtensionApiTest {
15 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
16 ExtensionApiTest::SetUpCommandLine(command_line);
17 command_line->AppendSwitch(switches::kAppsDevtool);
20 virtual void LoadExtensions() {
21 base::FilePath base_dir = test_data_dir_.AppendASCII("developer");
22 LoadNamedExtension(base_dir, "hosted_app");
26 void LoadNamedExtension(const base::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();
33 void InstallNamedExtension(const base::FilePath& path,
34 const std::string& name,
35 Manifest::Location install_source) {
36 const Extension* extension = InstallExtension(path.AppendASCII(name), 1,
38 ASSERT_TRUE(extension);
39 extension_name_to_ids_[name] = extension->id();
42 std::map<std::string, std::string> extension_name_to_ids_;
45 IN_PROC_BROWSER_TEST_F(DeveloperPrivateApiTest, Basics) {
48 base::FilePath basedir = test_data_dir_.AppendASCII("developer");
49 InstallNamedExtension(basedir, "packaged_app", Manifest::INTERNAL);
51 InstallNamedExtension(basedir, "simple_extension", Manifest::INTERNAL);
53 ASSERT_TRUE(RunExtensionSubtest(
54 "developer/test", "basics.html", kFlagLoadAsComponent));