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

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

Issue 14241002: Move the parsing of app.launch related keys out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 8 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
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"
6
7 #include "base/values.h" 5 #include "base/values.h"
8 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "chrome/common/extensions/app_launcher_info.h"
8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 TEST_F(ExtensionManifestTest, ValidApp) { 11 class ValidAppManifestTest : public ExtensionManifestTest {
12 protected:
13 virtual void SetUp() OVERRIDE {
14 ExtensionManifestTest::SetUp();
15 (new extensions::AppLaunchManifestHandler)->Register();
16 }
17 };
18
19 TEST_F(ValidAppManifestTest, ValidApp) {
12 scoped_refptr<extensions::Extension> extension( 20 scoped_refptr<extensions::Extension> extension(
13 LoadAndExpectSuccess("valid_app.json")); 21 LoadAndExpectSuccess("valid_app.json"));
14 extensions::URLPatternSet expected_patterns; 22 extensions::URLPatternSet expected_patterns;
15 AddPattern(&expected_patterns, "http://www.google.com/mail/*"); 23 AddPattern(&expected_patterns, "http://www.google.com/mail/*");
16 AddPattern(&expected_patterns, "http://www.google.com/foobar/*"); 24 AddPattern(&expected_patterns, "http://www.google.com/foobar/*");
17 EXPECT_EQ(expected_patterns, extension->web_extent()); 25 EXPECT_EQ(expected_patterns, extension->web_extent());
18 EXPECT_EQ(extension_misc::LAUNCH_TAB, extension->launch_container()); 26 EXPECT_EQ(extension_misc::LAUNCH_TAB,
19 EXPECT_EQ("http://www.google.com/mail/", extension->launch_web_url()); 27 extensions::AppLauncherInfo::GetLaunchContainer(extension));
28 EXPECT_EQ("http://www.google.com/mail/",
29 extensions::AppLauncherInfo::GetLaunchWebURL(extension));
20 } 30 }
21 31
22 TEST_F(ExtensionManifestTest, AllowUnrecognizedPermissions) { 32 TEST_F(ValidAppManifestTest, AllowUnrecognizedPermissions) {
23 std::string error; 33 std::string error;
24 scoped_ptr<DictionaryValue> manifest(LoadManifest("valid_app.json", &error)); 34 scoped_ptr<DictionaryValue> manifest(LoadManifest("valid_app.json", &error));
25 ListValue* permissions = NULL; 35 ListValue* permissions = NULL;
26 ASSERT_TRUE(manifest->GetList("permissions", &permissions)); 36 ASSERT_TRUE(manifest->GetList("permissions", &permissions));
27 permissions->Append(new StringValue("not-a-valid-permission")); 37 permissions->Append(new StringValue("not-a-valid-permission"));
28 LoadAndExpectSuccess(Manifest(manifest.get(), "")); 38 LoadAndExpectSuccess(Manifest(manifest.get(), ""));
29 } 39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698