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

Side by Side Diff: chrome/common/extensions/manifest_tests/extension_manifests_background_unittest.cc

Issue 10544059: Change the platform app manifest structure. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update for getDisplayPath, implement restrictions via _manifest_features.json Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/extensions/manifest_tests/extension_manifest_test.h" 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 scoped_ptr<DictionaryValue> manifest( 61 scoped_ptr<DictionaryValue> manifest(
62 LoadManifestFile("background_page_legacy.json", &error)); 62 LoadManifestFile("background_page_legacy.json", &error));
63 ASSERT_TRUE(manifest.get()); 63 ASSERT_TRUE(manifest.get());
64 extension = LoadAndExpectSuccess(Manifest(manifest.get(), "")); 64 extension = LoadAndExpectSuccess(Manifest(manifest.get(), ""));
65 ASSERT_TRUE(extension); 65 ASSERT_TRUE(extension);
66 EXPECT_EQ("/foo.html", extension->GetBackgroundURL().path()); 66 EXPECT_EQ("/foo.html", extension->GetBackgroundURL().path());
67 67
68 manifest->SetInteger(keys::kManifestVersion, 2); 68 manifest->SetInteger(keys::kManifestVersion, 2);
69 Feature* feature = SimpleFeatureProvider::GetManifestFeatures()-> 69 Feature* feature = SimpleFeatureProvider::GetManifestFeatures()->
70 GetFeature("background_page"); 70 GetFeature("background_page");
71 extension = LoadAndExpectSuccess(Manifest(manifest.get(), "")); 71 LoadAndExpectWarning(
72 ASSERT_TRUE(extension); 72 Manifest(manifest.get(), ""),
73 ASSERT_EQ(1u, extension->install_warnings().size()); 73 feature->GetErrorMessage(Feature::INVALID_MAX_MANIFEST_VERSION));
74 EXPECT_EQ(feature->GetErrorMessage(Feature::INVALID_MAX_MANIFEST_VERSION),
75 extension->install_warnings()[0]);
76 } 74 }
77 75
78 TEST_F(ExtensionManifestTest, BackgroundAllowNoJsAccess) { 76 TEST_F(ExtensionManifestTest, BackgroundAllowNoJsAccess) {
79 scoped_refptr<Extension> extension; 77 scoped_refptr<Extension> extension;
80 extension = LoadAndExpectSuccess("background_allow_no_js_access.json"); 78 extension = LoadAndExpectSuccess("background_allow_no_js_access.json");
81 ASSERT_TRUE(extension); 79 ASSERT_TRUE(extension);
82 EXPECT_FALSE(extension->allow_background_js_access()); 80 EXPECT_FALSE(extension->allow_background_js_access());
83 81
84 extension = LoadAndExpectSuccess("background_allow_no_js_access2.json"); 82 extension = LoadAndExpectSuccess("background_allow_no_js_access2.json");
85 ASSERT_TRUE(extension); 83 ASSERT_TRUE(extension);
(...skipping 16 matching lines...) Expand all
102 EXPECT_TRUE(extension->has_lazy_background_page()); 100 EXPECT_TRUE(extension->has_lazy_background_page());
103 101
104 ListValue* permissions = new ListValue(); 102 ListValue* permissions = new ListValue();
105 permissions->Append(Value::CreateStringValue("webRequest")); 103 permissions->Append(Value::CreateStringValue("webRequest"));
106 manifest->Set(keys::kPermissions, permissions); 104 manifest->Set(keys::kPermissions, permissions);
107 LoadAndExpectError(Manifest(manifest.get(), ""), 105 LoadAndExpectError(Manifest(manifest.get(), ""),
108 errors::kWebRequestConflictsWithLazyBackground); 106 errors::kWebRequestConflictsWithLazyBackground);
109 } 107 }
110 108
111 } // namespace extensions 109 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698