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

Side by Side Diff: chrome/common/extensions/manifest_handlers/content_scripts_manifest_unittest.cc

Issue 313453002: Resubmit: Block content scripts from executing until user grants permission (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master Created 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h" 7 #include "chrome/common/extensions/manifest_handlers/content_scripts_handler.h"
8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" 8 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h"
9 #include "extensions/common/error_utils.h" 9 #include "extensions/common/error_utils.h"
10 #include "extensions/common/extension.h" 10 #include "extensions/common/extension.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 URLPatternSet scriptable_hosts = 60 URLPatternSet scriptable_hosts =
61 ContentScriptsInfo::GetScriptableHosts(extension.get()); 61 ContentScriptsInfo::GetScriptableHosts(extension.get());
62 62
63 URLPatternSet expected; 63 URLPatternSet expected;
64 expected.AddPattern( 64 expected.AddPattern(
65 URLPattern(URLPattern::SCHEME_HTTP, "http://yahoo.com/*")); 65 URLPattern(URLPattern::SCHEME_HTTP, "http://yahoo.com/*"));
66 66
67 EXPECT_EQ(expected, scriptable_hosts); 67 EXPECT_EQ(expected, scriptable_hosts);
68 } 68 }
69 69
70 TEST_F(ContentScriptsManifestTest, ContentScriptIds) {
71 scoped_refptr<Extension> extension1 =
72 LoadAndExpectSuccess("content_script_yahoo.json");
73 scoped_refptr<Extension> extension2 =
74 LoadAndExpectSuccess("content_script_yahoo.json");
75 const UserScriptList& user_scripts1 =
76 ContentScriptsInfo::GetContentScripts(extension1);
77 ASSERT_EQ(1u, user_scripts1.size());
78 int64 id = user_scripts1[0].id();
79 const UserScriptList& user_scripts2 =
80 ContentScriptsInfo::GetContentScripts(extension2);
81 ASSERT_EQ(1u, user_scripts2.size());
82 // The id of the content script should be one higher than the previous.
83 EXPECT_EQ(id + 1, user_scripts2[0].id());
84 }
85
70 } // namespace extensions 86 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/manifest_handlers/content_scripts_handler.cc ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698