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

Unified Diff: extensions/common/manifest_handlers/incognito_manifest_unittest.cc

Issue 1351223003: Allow extensions to specify that they are not allowed in incognito mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add expectations for IncognitoInfo to test Created 5 years, 3 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
« no previous file with comments | « extensions/common/manifest_handlers/incognito_info.cc ('k') | extensions/extensions_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/common/manifest_handlers/incognito_manifest_unittest.cc
diff --git a/extensions/common/manifest_handlers/incognito_manifest_unittest.cc b/extensions/common/manifest_handlers/incognito_manifest_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..05511627906da49ac25d31a4ef9984f0f79a83e4
--- /dev/null
+++ b/extensions/common/manifest_handlers/incognito_manifest_unittest.cc
@@ -0,0 +1,45 @@
+// Copyright 2015 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 "extensions/browser/extension_util.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/manifest_handlers/incognito_info.h"
+#include "extensions/common/manifest_test.h"
+
+namespace extensions {
+
+using IncognitoManifestTest = ManifestTest;
+
+TEST_F(IncognitoManifestTest, IncognitoNotAllowed) {
+ scoped_refptr<Extension> extension(
+ LoadAndExpectSuccess("incognito_not_allowed.json"));
+ EXPECT_FALSE(IncognitoInfo::IsIncognitoAllowed(extension.get()));
+ EXPECT_FALSE(IncognitoInfo::IsSplitMode(extension.get()));
+ EXPECT_FALSE(util::CanBeIncognitoEnabled(extension.get()));
+}
+
+TEST_F(IncognitoManifestTest, IncognitoSpanning) {
+ scoped_refptr<Extension> extension(
+ LoadAndExpectSuccess("incognito_spanning.json"));
+ EXPECT_TRUE(IncognitoInfo::IsIncognitoAllowed(extension.get()));
+ EXPECT_FALSE(IncognitoInfo::IsSplitMode(extension.get()));
+ EXPECT_TRUE(util::CanBeIncognitoEnabled(extension.get()));
+}
+
+TEST_F(IncognitoManifestTest, IncognitoSplit) {
+ scoped_refptr<Extension> extension(
+ LoadAndExpectSuccess("incognito_split.json"));
+ EXPECT_TRUE(IncognitoInfo::IsIncognitoAllowed(extension.get()));
+ EXPECT_TRUE(IncognitoInfo::IsSplitMode(extension.get()));
+ EXPECT_TRUE(util::CanBeIncognitoEnabled(extension.get()));
+}
+
+TEST_F(IncognitoManifestTest, IncognitoUnspecified) {
+ scoped_refptr<Extension> extension(LoadAndExpectSuccess("minimal.json"));
+ EXPECT_TRUE(IncognitoInfo::IsIncognitoAllowed(extension.get()));
+ EXPECT_FALSE(IncognitoInfo::IsSplitMode(extension.get()));
+ EXPECT_TRUE(util::CanBeIncognitoEnabled(extension.get()));
+}
+
+} // namespace extensions
« no previous file with comments | « extensions/common/manifest_handlers/incognito_info.cc ('k') | extensions/extensions_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698