OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 "apps/launcher.h" |
| 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/path_service.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "extensions/common/manifest_handlers/action_handlers_handler.h" |
| 11 #include "extensions/test/extension_test_message_listener.h" |
| 12 |
| 13 namespace app_runtime = extensions::api::app_runtime; |
| 14 |
| 15 using ActionHandlersBrowserTest = ExtensionApiTest; |
| 16 |
| 17 IN_PROC_BROWSER_TEST_F(ActionHandlersBrowserTest, LaunchAppWithNewNote) { |
| 18 // Load the app. Make sure to wait until it is done loading. |
| 19 ExtensionTestMessageListener loader("loaded", false); |
| 20 base::FilePath path = |
| 21 test_data_dir_.AppendASCII("action_handlers").AppendASCII("new_note"); |
| 22 const extensions::Extension* app = LoadExtension(path); |
| 23 ASSERT_TRUE(app); |
| 24 EXPECT_TRUE(extensions::ActionHandlersInfo::HasActionHandler( |
| 25 app, app_runtime::ACTION_TYPE_NEW_NOTE)); |
| 26 loader.WaitUntilSatisfied(); |
| 27 |
| 28 // Fire a "new_note" action type, assert that app has received it. |
| 29 ExtensionTestMessageListener new_note("hasNewNote = true", false); |
| 30 auto action_data = base::MakeUnique<app_runtime::ActionData>(); |
| 31 action_data->action_type = app_runtime::ActionType::ACTION_TYPE_NEW_NOTE; |
| 32 apps::LaunchPlatformAppWithAction(profile(), app, std::move(action_data), |
| 33 base::FilePath()); |
| 34 new_note.WaitUntilSatisfied(); |
| 35 } |
OLD | NEW |