Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "testing/gtest/include/gtest/gtest.h" | |
| 6 | |
| 7 #include "chrome/browser/extensions/extension_content_settings_helpers.h" | |
| 8 | |
| 9 namespace helpers = extension_content_settings_helpers; | |
| 10 | |
| 11 TEST(ExtensionContentSettingsHelpersTest, ParseExtensionPattern) { | |
| 12 const struct { | |
| 13 const char* extension_pattern; | |
| 14 const char* content_settings_pattern; | |
| 15 } kTestPatterns[] = { | |
| 16 { "<all_urls>", "*" }, | |
| 17 { "*://*.google.com/*", "[*.]google.com" }, | |
| 18 { "http://www.example.com/*", "http://www.example.com:80" }, | |
| 19 { "file:///foo/bar/baz", "file:///foo/bar/baz" }, | |
|
Matt Perry
2011/06/24 18:53:58
could you add a few more cases (test port and http
Bernhard Bauer
2011/06/28 16:46:31
Done.
| |
| 20 }; | |
| 21 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestPatterns); ++i) { | |
| 22 std::string error; | |
| 23 std::string pattern_str = helpers::ParseExtensionPattern( | |
| 24 kTestPatterns[i].extension_pattern, &error).ToString(); | |
| 25 EXPECT_STREQ(kTestPatterns[i].content_settings_pattern, pattern_str.c_str()) | |
| 26 << "Unexpected error parsing " << kTestPatterns[i].extension_pattern | |
| 27 << ": " << error; | |
| 28 } | |
| 29 } | |
| OLD | NEW |