summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-14 01:35:27 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-14 01:35:27 +0000
commita16ed65e3c9cd0a920692d6695b5be70ccea9c93 (patch)
tree96dd6a0224e92b76c9b0a662835ae4d08bb50985 /chrome/common/extensions
parent5a82010ab774e803a0a69328fdf56a37dee91e86 (diff)
downloadchromium_src-a16ed65e3c9cd0a920692d6695b5be70ccea9c93.zip
chromium_src-a16ed65e3c9cd0a920692d6695b5be70ccea9c93.tar.gz
chromium_src-a16ed65e3c9cd0a920692d6695b5be70ccea9c93.tar.bz2
NO CODE CHANGE.
Fix EOL-style on a few files. Review URL: http://codereview.chromium.org/21373 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions')
-rw-r--r--chrome/common/extensions/user_script_unittest.cc202
1 files changed, 101 insertions, 101 deletions
diff --git a/chrome/common/extensions/user_script_unittest.cc b/chrome/common/extensions/user_script_unittest.cc
index 0266260..72204f4 100644
--- a/chrome/common/extensions/user_script_unittest.cc
+++ b/chrome/common/extensions/user_script_unittest.cc
@@ -1,101 +1,101 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/file_path.h"
-#include "base/logging.h"
-#include "chrome/common/extensions/user_script.h"
-#include "googleurl/src/gurl.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-TEST(UserScriptTest, Match1) {
- UserScript script;
- script.add_glob("*mail.google.com*");
- script.add_glob("*mail.yahoo.com*");
- script.add_glob("*mail.msn.com*");
- EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com")));
- EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com/foo")));
- EXPECT_TRUE(script.MatchesUrl(GURL("https://mail.google.com/foo")));
- EXPECT_TRUE(script.MatchesUrl(GURL("ftp://mail.google.com/foo")));
- EXPECT_TRUE(script.MatchesUrl(GURL("http://woo.mail.google.com/foo")));
- EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.yahoo.com/bar")));
- EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.msn.com/baz")));
- EXPECT_FALSE(script.MatchesUrl(GURL("http://www.hotmail.com")));
-}
-
-TEST(UserScriptTest, Match2) {
- UserScript script;
- script.add_glob("*mail.google.com/");
- // GURL normalizes the URL to have a trailing "/"
- EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com")));
- EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com/")));
- EXPECT_FALSE(script.MatchesUrl(GURL("http://mail.google.com/foo")));
-}
-
-TEST(UserScriptTest, Match3) {
- UserScript script;
- script.add_glob("http://mail.google.com/*");
- // GURL normalizes the URL to have a trailing "/"
- EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com")));
- EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com/foo")));
- EXPECT_FALSE(script.MatchesUrl(GURL("https://mail.google.com/foo")));
-}
-
-TEST(UserScriptTest, Match4) {
- UserScript script;
- script.add_glob("*");
- EXPECT_TRUE(script.MatchesUrl(GURL("http://foo.com/bar")));
- EXPECT_TRUE(script.MatchesUrl(GURL("http://hot.com/dog")));
- EXPECT_TRUE(script.MatchesUrl(GURL("https://hot.com/dog")));
- EXPECT_TRUE(script.MatchesUrl(GURL("file:///foo/bar")));
-}
-
-TEST(UserScriptTest, Match5) {
- UserScript script;
- script.add_glob("*foo*");
- EXPECT_TRUE(script.MatchesUrl(GURL("http://foo.com/bar")));
- EXPECT_TRUE(script.MatchesUrl(GURL("http://baz.org/foo/bar")));
- EXPECT_FALSE(script.MatchesUrl(GURL("http://baz.org")));
-}
-
-TEST(UserScriptTest, Match6) {
- URLPattern pattern;
- ASSERT_TRUE(pattern.Parse("http://*/foo*"));
-
- UserScript script;
- script.add_url_pattern(pattern);
- EXPECT_TRUE(script.MatchesUrl(GURL("http://monkey.com/foobar")));
- EXPECT_FALSE(script.MatchesUrl(GURL("http://monkey.com/hotdog")));
-
- // NOTE: URLPattern is tested more extensively in url_pattern_unittest.cc.
-}
-
-TEST(UserScriptTest, Pickle) {
- URLPattern pattern1;
- URLPattern pattern2;
- ASSERT_TRUE(pattern1.Parse("http://*/foo*"));
- ASSERT_TRUE(pattern2.Parse("http://bar/baz*"));
-
- UserScript script1;
- script1.set_url(GURL("chrome-user-script:/foo.user.js"));
- script1.add_url_pattern(pattern1);
- script1.add_url_pattern(pattern2);
-
- Pickle pickle;
- script1.Pickle(&pickle);
-
- void* iter = NULL;
- UserScript script2;
- script2.Unpickle(pickle, &iter);
-
- EXPECT_EQ(script1.url(), script2.url());
- ASSERT_EQ(script1.globs().size(), script2.globs().size());
- for (size_t i = 0; i < script1.globs().size(); ++i) {
- EXPECT_EQ(script1.globs()[i], script2.globs()[i]);
- }
- ASSERT_EQ(script1.url_patterns().size(), script2.url_patterns().size());
- for (size_t i = 0; i < script1.url_patterns().size(); ++i) {
- EXPECT_EQ(script1.url_patterns()[i].GetAsString(),
- script2.url_patterns()[i].GetAsString());
- }
-}
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/file_path.h"
+#include "base/logging.h"
+#include "chrome/common/extensions/user_script.h"
+#include "googleurl/src/gurl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(UserScriptTest, Match1) {
+ UserScript script;
+ script.add_glob("*mail.google.com*");
+ script.add_glob("*mail.yahoo.com*");
+ script.add_glob("*mail.msn.com*");
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com/foo")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("https://mail.google.com/foo")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("ftp://mail.google.com/foo")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://woo.mail.google.com/foo")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.yahoo.com/bar")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.msn.com/baz")));
+ EXPECT_FALSE(script.MatchesUrl(GURL("http://www.hotmail.com")));
+}
+
+TEST(UserScriptTest, Match2) {
+ UserScript script;
+ script.add_glob("*mail.google.com/");
+ // GURL normalizes the URL to have a trailing "/"
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com/")));
+ EXPECT_FALSE(script.MatchesUrl(GURL("http://mail.google.com/foo")));
+}
+
+TEST(UserScriptTest, Match3) {
+ UserScript script;
+ script.add_glob("http://mail.google.com/*");
+ // GURL normalizes the URL to have a trailing "/"
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com/foo")));
+ EXPECT_FALSE(script.MatchesUrl(GURL("https://mail.google.com/foo")));
+}
+
+TEST(UserScriptTest, Match4) {
+ UserScript script;
+ script.add_glob("*");
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://foo.com/bar")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://hot.com/dog")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("https://hot.com/dog")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("file:///foo/bar")));
+}
+
+TEST(UserScriptTest, Match5) {
+ UserScript script;
+ script.add_glob("*foo*");
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://foo.com/bar")));
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://baz.org/foo/bar")));
+ EXPECT_FALSE(script.MatchesUrl(GURL("http://baz.org")));
+}
+
+TEST(UserScriptTest, Match6) {
+ URLPattern pattern;
+ ASSERT_TRUE(pattern.Parse("http://*/foo*"));
+
+ UserScript script;
+ script.add_url_pattern(pattern);
+ EXPECT_TRUE(script.MatchesUrl(GURL("http://monkey.com/foobar")));
+ EXPECT_FALSE(script.MatchesUrl(GURL("http://monkey.com/hotdog")));
+
+ // NOTE: URLPattern is tested more extensively in url_pattern_unittest.cc.
+}
+
+TEST(UserScriptTest, Pickle) {
+ URLPattern pattern1;
+ URLPattern pattern2;
+ ASSERT_TRUE(pattern1.Parse("http://*/foo*"));
+ ASSERT_TRUE(pattern2.Parse("http://bar/baz*"));
+
+ UserScript script1;
+ script1.set_url(GURL("chrome-user-script:/foo.user.js"));
+ script1.add_url_pattern(pattern1);
+ script1.add_url_pattern(pattern2);
+
+ Pickle pickle;
+ script1.Pickle(&pickle);
+
+ void* iter = NULL;
+ UserScript script2;
+ script2.Unpickle(pickle, &iter);
+
+ EXPECT_EQ(script1.url(), script2.url());
+ ASSERT_EQ(script1.globs().size(), script2.globs().size());
+ for (size_t i = 0; i < script1.globs().size(); ++i) {
+ EXPECT_EQ(script1.globs()[i], script2.globs()[i]);
+ }
+ ASSERT_EQ(script1.url_patterns().size(), script2.url_patterns().size());
+ for (size_t i = 0; i < script1.url_patterns().size(); ++i) {
+ EXPECT_EQ(script1.url_patterns()[i].GetAsString(),
+ script2.url_patterns()[i].GetAsString());
+ }
+}