Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4142)

Unified Diff: chrome/browser/chromeos/extensions/action_handlers/action_handlers_apitest.cc

Issue 2693053002: cros: Add e2e tests for new_note action handler. Flip feature to stable. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/action_handlers/action_handlers_apitest.cc
diff --git a/chrome/browser/chromeos/extensions/action_handlers/action_handlers_apitest.cc b/chrome/browser/chromeos/extensions/action_handlers/action_handlers_apitest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e2a2aed6808a57b08a2492f19c7be983a8bc39b7
--- /dev/null
+++ b/chrome/browser/chromeos/extensions/action_handlers/action_handlers_apitest.cc
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "apps/launcher.h"
+#include "base/memory/ptr_util.h"
+#include "base/path_service.h"
+#include "chrome/browser/extensions/extension_apitest.h"
+#include "chrome/common/chrome_paths.h"
+#include "extensions/common/manifest_handlers/action_handlers_handler.h"
+#include "extensions/test/extension_test_message_listener.h"
+
+namespace app_runtime = extensions::api::app_runtime;
+
+namespace {
+
+class ActionHandlersBrowserTest : public ExtensionApiTest {};
Devlin 2017/02/17 23:43:06 nit: prefer just "using ActionHandlersBrowserTest
jdufault 2017/02/21 21:07:40 Done.
+
+} // namespace
+
+IN_PROC_BROWSER_TEST_F(ActionHandlersBrowserTest, LaunchAppWithNewNote) {
+ // Load the app. Make sure to wait until it is done loading.
+ ExtensionTestMessageListener loader("loaded", false);
+ base::FilePath dir;
+ PathService::Get(chrome::DIR_TEST_DATA, &dir);
+ dir = dir.AppendASCII("extensions")
+ .AppendASCII("api_test")
Devlin 2017/02/17 23:43:06 test_data_dir_ should already point to chrome/test
jdufault 2017/02/21 21:07:40 Done.
+ .AppendASCII("action_handlers")
+ .AppendASCII("new_note");
+ const extensions::Extension* app = LoadExtension(dir);
+ CHECK(app);
Devlin 2017/02/17 23:43:06 s/CHECK/ASSERT_TRUE
jdufault 2017/02/21 21:07:40 Done.
+ EXPECT_TRUE(extensions::ActionHandlersInfo::HasActionHandler(
+ app, app_runtime::ACTION_TYPE_NEW_NOTE));
+ loader.WaitUntilSatisfied();
+
+ // Fire a "new_note" action type, assert that app has received it.
+ ExtensionTestMessageListener new_note("hasNewNote = true", false);
+ auto action_data = base::MakeUnique<app_runtime::ActionData>();
+ action_data->action_type = app_runtime::ActionType::ACTION_TYPE_NEW_NOTE;
+ apps::LaunchPlatformAppWithAction(profile(), app, std::move(action_data),
+ base::FilePath());
+ new_note.WaitUntilSatisfied();
+}
« no previous file with comments | « no previous file | chrome/test/BUILD.gn » ('j') | chrome/test/data/extensions/api_test/action_handlers/new_note/manifest.json » ('J')

Powered by Google App Engine
This is Rietveld 408576698