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

Side by Side Diff: chrome/common/extensions/extension_set_unittest.cc

Issue 16625012: Remove ExtensionURLInfo, make security decisions in render process (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address feedback Created 7 years, 5 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 "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.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/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 EXPECT_EQ(1u, extensions.size()); 76 EXPECT_EQ(1u, extensions.size());
77 EXPECT_EQ(ext2, extensions.GetByID(ext1->id())); 77 EXPECT_EQ(ext2, extensions.GetByID(ext1->id()));
78 78
79 // Add the other extensions. 79 // Add the other extensions.
80 EXPECT_TRUE(extensions.Insert(ext3)); 80 EXPECT_TRUE(extensions.Insert(ext3));
81 EXPECT_TRUE(extensions.Insert(ext4)); 81 EXPECT_TRUE(extensions.Insert(ext4));
82 EXPECT_EQ(3u, extensions.size()); 82 EXPECT_EQ(3u, extensions.size());
83 83
84 // Get extension by its chrome-extension:// URL 84 // Get extension by its chrome-extension:// URL
85 EXPECT_EQ(ext2, extensions.GetExtensionOrAppByURL( 85 EXPECT_EQ(ext2, extensions.GetExtensionOrAppByURL(
86 ExtensionURLInfo(ext2->GetResourceURL("test.html")))); 86 ext2->GetResourceURL("test.html")));
87 EXPECT_EQ(ext3, extensions.GetExtensionOrAppByURL( 87 EXPECT_EQ(ext3, extensions.GetExtensionOrAppByURL(
88 ExtensionURLInfo(ext3->GetResourceURL("test.html")))); 88 ext3->GetResourceURL("test.html")));
89 EXPECT_EQ(ext4, extensions.GetExtensionOrAppByURL( 89 EXPECT_EQ(ext4, extensions.GetExtensionOrAppByURL(
90 ExtensionURLInfo(ext4->GetResourceURL("test.html")))); 90 ext4->GetResourceURL("test.html")));
91 91
92 // Get extension by web extent. 92 // Get extension by web extent.
93 EXPECT_EQ(ext2, extensions.GetExtensionOrAppByURL( 93 EXPECT_EQ(ext2, extensions.GetExtensionOrAppByURL(
94 ExtensionURLInfo(GURL("http://code.google.com/p/chromium/monkey")))); 94 GURL("http://code.google.com/p/chromium/monkey")));
95 EXPECT_EQ(ext3, extensions.GetExtensionOrAppByURL( 95 EXPECT_EQ(ext3, extensions.GetExtensionOrAppByURL(
96 ExtensionURLInfo(GURL("http://dev.chromium.org/design-docs/")))); 96 GURL("http://dev.chromium.org/design-docs/")));
97 EXPECT_FALSE(extensions.GetExtensionOrAppByURL( 97 EXPECT_FALSE(extensions.GetExtensionOrAppByURL(
98 ExtensionURLInfo(GURL("http://blog.chromium.org/")))); 98 GURL("http://blog.chromium.org/")));
99 99
100 // Test InSameExtent(). 100 // Test InSameExtent().
101 EXPECT_TRUE(extensions.InSameExtent( 101 EXPECT_TRUE(extensions.InSameExtent(
102 GURL("http://code.google.com/p/chromium/monkey/"), 102 GURL("http://code.google.com/p/chromium/monkey/"),
103 GURL("http://code.google.com/p/chromium/"))); 103 GURL("http://code.google.com/p/chromium/")));
104 EXPECT_FALSE(extensions.InSameExtent( 104 EXPECT_FALSE(extensions.InSameExtent(
105 GURL("http://code.google.com/p/chromium/"), 105 GURL("http://code.google.com/p/chromium/"),
106 GURL("https://code.google.com/p/chromium/"))); 106 GURL("https://code.google.com/p/chromium/")));
107 EXPECT_FALSE(extensions.InSameExtent( 107 EXPECT_FALSE(extensions.InSameExtent(
108 GURL("http://code.google.com/p/chromium/"), 108 GURL("http://code.google.com/p/chromium/"),
(...skipping 22 matching lines...) Expand all
131 EXPECT_TRUE(to_add->Insert(ext5)); 131 EXPECT_TRUE(to_add->Insert(ext5));
132 EXPECT_TRUE(to_add->Insert(ext6)); 132 EXPECT_TRUE(to_add->Insert(ext6));
133 133
134 ASSERT_TRUE(extensions.Contains(ext3->id())); 134 ASSERT_TRUE(extensions.Contains(ext3->id()));
135 ASSERT_TRUE(extensions.InsertAll(*to_add)); 135 ASSERT_TRUE(extensions.InsertAll(*to_add));
136 EXPECT_EQ(4u, extensions.size()); 136 EXPECT_EQ(4u, extensions.size());
137 137
138 ASSERT_FALSE(extensions.InsertAll(*to_add)); // Re-adding same set no-ops. 138 ASSERT_FALSE(extensions.InsertAll(*to_add)); // Re-adding same set no-ops.
139 EXPECT_EQ(4u, extensions.size()); 139 EXPECT_EQ(4u, extensions.size());
140 } 140 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_set.cc ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698