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

Unified Diff: chrome/browser/extensions/user_script_master_unittest.cc

Issue 7347011: Update URLPatternSet to contain a std::set instead of std::vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows compile errors. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/user_script_master.cc ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_master_unittest.cc
diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc
index c5d6af11f81ff17604d5ee78caecf29dc8667011..0ae3a4cb921fefa191468df67499e218441750b6 100644
--- a/chrome/browser/extensions/user_script_master_unittest.cc
+++ b/chrome/browser/extensions/user_script_master_unittest.cc
@@ -19,6 +19,15 @@
#include "content/common/notification_service.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace {
+
+static void AddPattern(URLPatternSet* extent, const std::string& pattern) {
+ int schemes = URLPattern::SCHEME_ALL;
+ extent->AddPattern(URLPattern(schemes, pattern));
+}
+
+}
+
// Test bringing up a master on a specific directory, putting a script
// in there, etc.
@@ -142,15 +151,15 @@ TEST_F(UserScriptMasterTest, Parse4) {
"// @match \t http://mail.yahoo.com/*\n"
"// ==/UserScript==\n");
+ URLPatternSet expected_patterns;
+ AddPattern(&expected_patterns, "http://*.mail.google.com/*");
+ AddPattern(&expected_patterns, "http://mail.yahoo.com/*");
+
UserScript script;
EXPECT_TRUE(UserScriptMaster::ScriptReloader::ParseMetadataHeader(
text, &script));
EXPECT_EQ(0U, script.globs().size());
- ASSERT_EQ(2U, script.url_patterns().size());
- EXPECT_EQ("http://*.mail.google.com/*",
- script.url_patterns()[0].GetAsString());
- EXPECT_EQ("http://mail.yahoo.com/*",
- script.url_patterns()[1].GetAsString());
+ EXPECT_EQ(expected_patterns, script.url_patterns());
}
TEST_F(UserScriptMasterTest, Parse5) {
@@ -192,9 +201,9 @@ TEST_F(UserScriptMasterTest, Parse7) {
text, &script));
ASSERT_EQ("hello", script.name());
ASSERT_EQ("wiggity woo", script.description());
- ASSERT_EQ(1U, script.url_patterns().size());
+ ASSERT_EQ(1U, script.url_patterns().patterns().size());
EXPECT_EQ("http://mail.yahoo.com/*",
- script.url_patterns()[0].GetAsString());
+ script.url_patterns().begin()->GetAsString());
}
TEST_F(UserScriptMasterTest, SkipBOMAtTheBeginning) {
« no previous file with comments | « chrome/browser/extensions/user_script_master.cc ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698