OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/logging.h" | |
7 #include "chrome/common/extensions/user_script.h" | 6 #include "chrome/common/extensions/user_script.h" |
8 #include "googleurl/src/gurl.h" | 7 #include "googleurl/src/gurl.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
10 | 9 |
11 TEST(UserScriptTest, Match1) { | 10 TEST(UserScriptTest, Match1) { |
12 UserScript script; | 11 UserScript script; |
13 script.add_glob("*mail.google.com*"); | 12 script.add_glob("*mail.google.com*"); |
14 script.add_glob("*mail.yahoo.com*"); | 13 script.add_glob("*mail.yahoo.com*"); |
15 script.add_glob("*mail.msn.com*"); | 14 script.add_glob("*mail.msn.com*"); |
16 EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com"))); | 15 EXPECT_TRUE(script.MatchesUrl(GURL("http://mail.google.com"))); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 for (size_t i = 0; i < script1.url_patterns().size(); ++i) { | 97 for (size_t i = 0; i < script1.url_patterns().size(); ++i) { |
99 EXPECT_EQ(script1.url_patterns()[i].GetAsString(), | 98 EXPECT_EQ(script1.url_patterns()[i].GetAsString(), |
100 script2.url_patterns()[i].GetAsString()); | 99 script2.url_patterns()[i].GetAsString()); |
101 } | 100 } |
102 } | 101 } |
103 | 102 |
104 TEST(UserScriptTest, Defaults) { | 103 TEST(UserScriptTest, Defaults) { |
105 UserScript script; | 104 UserScript script; |
106 ASSERT_EQ(UserScript::DOCUMENT_END, script.run_location()); | 105 ASSERT_EQ(UserScript::DOCUMENT_END, script.run_location()); |
107 } | 106 } |
OLD | NEW |