Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / api / inline_install_private / inline_install_private_apitest.cc
blob7cf7f3450b704025908e5ae9e1b5420b5b7ed31a
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 {
14 public:
15 InlineInstallPrivateApiTestBase(const std::string& basedir,
16 const std::string& extension_file) :
17 WebstoreInstallerTest("cws.com",
18 basedir,
19 extension_file,
20 "test1.com",
21 "test2.com") {
24 void Run(const std::string& testName) {
25 AutoAcceptInstall();
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 {
40 public:
41 InlineInstallPrivateApiTestApp() :
42 InlineInstallPrivateApiTestBase(
43 "extensions/api_test/inline_install_private/",
44 "app.crx") {}
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) {
58 Run("noGesture");
61 class InlineInstallPrivateApiTestExtension :
62 public InlineInstallPrivateApiTestBase {
63 public:
64 InlineInstallPrivateApiTestExtension() :
65 InlineInstallPrivateApiTestBase(
66 "extensions/api_test/webstore_inline_install",
67 "extension.crx") {}
70 IN_PROC_BROWSER_TEST_F(InlineInstallPrivateApiTestExtension, OnlyApps) {
71 ExtensionFunction::ScopedUserGestureForTests gesture;
72 Run("onlyApps");
75 } // namespace extensions