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 LoadExtensions() {
16 base::FilePath base_dir = test_data_dir_.AppendASCII("developer");
17 LoadNamedExtension(base_dir, "hosted_app");
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();
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,
33 ASSERT_TRUE(extension);
34 extension_name_to_ids_[name] = extension->id();
37 std::map<std::string, std::string> extension_name_to_ids_;
40 IN_PROC_BROWSER_TEST_F(DeveloperPrivateApiTest, Basics) {
43 base::FilePath basedir = test_data_dir_.AppendASCII("developer");
44 InstallNamedExtension(basedir, "packaged_app", Manifest::INTERNAL);
46 InstallNamedExtension(basedir, "simple_extension", Manifest::INTERNAL);
48 ASSERT_TRUE(RunPlatformAppTestWithFlags(
49 "developer/test", kFlagLoadAsComponent));