1 // Copyright 2014 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.
5 #include "base/command_line.h"
6 #include "chrome/browser/extensions/api/inline_install_private/inline_install_private_api.h"
7 #include "chrome/browser/extensions/extension_install_prompt.h"
8 #include "chrome/browser/extensions/webstore_installer_test.h"
9 #include "extensions/test/extension_test_message_listener.h"
11 namespace extensions
{
13 class InlineInstallPrivateApiTestBase
: public WebstoreInstallerTest
{
15 InlineInstallPrivateApiTestBase(const std::string
& basedir
,
16 const std::string
& extension_file
) :
17 WebstoreInstallerTest("cws.com",
24 void Run(const std::string
& testName
) {
26 base::FilePath test_driver_path
= test_data_dir_
.AppendASCII(
27 "api_test/inline_install_private/test_driver");
29 ExtensionTestMessageListener
ready_listener("ready", true);
30 ExtensionTestMessageListener
success_listener("success", false);
31 LoadExtension(test_driver_path
);
32 ready_listener
.WaitUntilSatisfied();
33 ready_listener
.Reply(testName
);
34 ASSERT_TRUE(success_listener
.WaitUntilSatisfied());
38 class InlineInstallPrivateApiTestApp
:
39 public InlineInstallPrivateApiTestBase
{
41 InlineInstallPrivateApiTestApp() :
42 InlineInstallPrivateApiTestBase(
43 "extensions/api_test/inline_install_private/",
47 IN_PROC_BROWSER_TEST_F(InlineInstallPrivateApiTestApp
, SuccessfulInstall
) {
48 ExtensionFunction::ScopedUserGestureForTests gesture
;
49 Run("successfulInstall");
52 IN_PROC_BROWSER_TEST_F(InlineInstallPrivateApiTestApp
, BackgroundInstall
) {
53 ExtensionFunction::ScopedUserGestureForTests gesture
;
54 Run("backgroundInstall");
57 IN_PROC_BROWSER_TEST_F(InlineInstallPrivateApiTestApp
, NoGesture
) {
61 class InlineInstallPrivateApiTestExtension
:
62 public InlineInstallPrivateApiTestBase
{
64 InlineInstallPrivateApiTestExtension() :
65 InlineInstallPrivateApiTestBase(
66 "extensions/api_test/webstore_inline_install",
70 IN_PROC_BROWSER_TEST_F(InlineInstallPrivateApiTestExtension
, OnlyApps
) {
71 ExtensionFunction::ScopedUserGestureForTests gesture
;
75 } // namespace extensions