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

Side by Side Diff: extensions/common/manifest_handlers/action_handlers_handler_unittest.cc

Issue 2693053002: cros: Add e2e tests for new_note action handler. Flip feature to stable. (Closed)
Patch Set: Address comments 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 unified diff | Download patch
« no previous file with comments | « extensions/common/api/_manifest_features.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/test/values_test_util.h" 5 #include "base/test/values_test_util.h"
6 #include "components/version_info/version_info.h" 6 #include "components/version_info/version_info.h"
7 #include "extensions/common/features/feature_channel.h" 7 #include "extensions/common/features/feature_channel.h"
8 #include "extensions/common/manifest_constants.h" 8 #include "extensions/common/manifest_constants.h"
9 #include "extensions/common/manifest_handlers/action_handlers_handler.h" 9 #include "extensions/common/manifest_handlers/action_handlers_handler.h"
10 #include "extensions/common/manifest_test.h" 10 #include "extensions/common/manifest_test.h"
(...skipping 30 matching lines...) Expand all
41 const Extension* extension) { 41 const Extension* extension) {
42 ActionHandlersInfo* info = static_cast<ActionHandlersInfo*>( 42 ActionHandlersInfo* info = static_cast<ActionHandlersInfo*>(
43 extension->GetManifestData(manifest_keys::kActionHandlers)); 43 extension->GetManifestData(manifest_keys::kActionHandlers));
44 return info ? info->action_handlers : std::set<app_runtime::ActionType>(); 44 return info ? info->action_handlers : std::set<app_runtime::ActionType>();
45 } 45 }
46 }; 46 };
47 47
48 } // namespace 48 } // namespace
49 49
50 TEST_F(ActionHandlersManifestTest, InvalidType) { 50 TEST_F(ActionHandlersManifestTest, InvalidType) {
51 extensions::ScopedCurrentChannel channel(version_info::Channel::DEV);
52 LoadAndExpectError(CreateManifest("32"), 51 LoadAndExpectError(CreateManifest("32"),
53 manifest_errors::kInvalidActionHandlersType); 52 manifest_errors::kInvalidActionHandlersType);
54 LoadAndExpectError(CreateManifest("[true]"), 53 LoadAndExpectError(CreateManifest("[true]"),
55 manifest_errors::kInvalidActionHandlersType); 54 manifest_errors::kInvalidActionHandlersType);
56 LoadAndExpectError(CreateManifest("[\"invalid_handler\"]"), 55 LoadAndExpectError(CreateManifest("[\"invalid_handler\"]"),
57 manifest_errors::kInvalidActionHandlersActionType); 56 manifest_errors::kInvalidActionHandlersActionType);
58 } 57 }
59 58
60 TEST_F(ActionHandlersManifestTest, VerifyParse) { 59 TEST_F(ActionHandlersManifestTest, VerifyParse) {
61 extensions::ScopedCurrentChannel channel(version_info::Channel::DEV);
62 scoped_refptr<Extension> none = LoadAndExpectSuccess(CreateManifest("[]")); 60 scoped_refptr<Extension> none = LoadAndExpectSuccess(CreateManifest("[]"));
63 EXPECT_EQ(std::set<app_runtime::ActionType>{}, GetActionHandlers(none.get())); 61 EXPECT_EQ(std::set<app_runtime::ActionType>{}, GetActionHandlers(none.get()));
64 62
65 scoped_refptr<Extension> new_note = 63 scoped_refptr<Extension> new_note =
66 LoadAndExpectSuccess(CreateManifest("[\"new_note\"]")); 64 LoadAndExpectSuccess(CreateManifest("[\"new_note\"]"));
67 EXPECT_EQ( 65 EXPECT_EQ(
68 std::set<app_runtime::ActionType>{app_runtime::ACTION_TYPE_NEW_NOTE}, 66 std::set<app_runtime::ActionType>{app_runtime::ACTION_TYPE_NEW_NOTE},
69 GetActionHandlers(new_note.get())); 67 GetActionHandlers(new_note.get()));
70 } 68 }
71 69
72 } // namespace extensions 70 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/api/_manifest_features.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698