OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/content_settings_helper.h" | 5 #include "chrome/common/content_settings_helper.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | |
7 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 TEST(ContentSettingsHelperTest, OriginToWString) { | 11 TEST(ContentSettingsHelperTest, OriginToWString) { |
viettrungluu
2010/12/29 23:41:17
Rename this test?
I also wonder why there isn't a
Avi (use Gerrit)
2010/12/30 00:04:15
Done. Re test possibly because the 16 version is i
| |
11 // Urls with "http": | 12 // Urls with "http": |
12 const GURL kUrl0("http://www.foo.com/bar"); | 13 const GURL kUrl0("http://www.foo.com/bar"); |
13 const GURL kUrl1("http://foo.com/bar"); | 14 const GURL kUrl1("http://foo.com/bar"); |
14 | 15 |
15 const GURL kUrl2("http://www.foo.com:81/bar"); | 16 const GURL kUrl2("http://www.foo.com:81/bar"); |
16 const GURL kUrl3("http://foo.com:81/bar"); | 17 const GURL kUrl3("http://foo.com:81/bar"); |
17 | 18 |
18 // Urls with "https": | 19 // Urls with "https": |
19 const GURL kUrl4("https://www.foo.com/bar"); | 20 const GURL kUrl4("https://www.foo.com/bar"); |
20 const GURL kUrl5("https://foo.com/bar"); | 21 const GURL kUrl5("https://foo.com/bar"); |
21 | 22 |
22 const GURL kUrl6("https://www.foo.com:81/bar"); | 23 const GURL kUrl6("https://www.foo.com:81/bar"); |
23 const GURL kUrl7("https://foo.com:81/bar"); | 24 const GURL kUrl7("https://foo.com:81/bar"); |
24 | 25 |
25 // Now check the first group of urls with just "http": | 26 // Now check the first group of urls with just "http": |
26 EXPECT_EQ(L"www.foo.com", content_settings_helper::OriginToWString(kUrl0)); | 27 EXPECT_EQ(ASCIIToUTF16("www.foo.com"), |
27 EXPECT_EQ(L"foo.com", content_settings_helper::OriginToWString(kUrl1)); | 28 content_settings_helper::OriginToString16(kUrl0)); |
29 EXPECT_EQ(ASCIIToUTF16("foo.com"), | |
30 content_settings_helper::OriginToString16(kUrl1)); | |
28 | 31 |
29 EXPECT_EQ(L"www.foo.com:81", content_settings_helper::OriginToWString(kUrl2)); | 32 EXPECT_EQ(ASCIIToUTF16("www.foo.com:81"), |
30 EXPECT_EQ(L"foo.com:81", content_settings_helper::OriginToWString(kUrl3)); | 33 content_settings_helper::OriginToString16(kUrl2)); |
34 EXPECT_EQ(ASCIIToUTF16("foo.com:81"), | |
35 content_settings_helper::OriginToString16(kUrl3)); | |
31 | 36 |
32 // Now check the second group of urls with "https": | 37 // Now check the second group of urls with "https": |
33 EXPECT_EQ(L"https://www.foo.com", | 38 EXPECT_EQ(ASCIIToUTF16("https://www.foo.com"), |
34 content_settings_helper::OriginToWString(kUrl4)); | 39 content_settings_helper::OriginToString16(kUrl4)); |
35 EXPECT_EQ(L"https://foo.com", | 40 EXPECT_EQ(ASCIIToUTF16("https://foo.com"), |
36 content_settings_helper::OriginToWString(kUrl5)); | 41 content_settings_helper::OriginToString16(kUrl5)); |
37 | 42 |
38 EXPECT_EQ(L"https://www.foo.com:81", | 43 EXPECT_EQ(ASCIIToUTF16("https://www.foo.com:81"), |
39 content_settings_helper::OriginToWString(kUrl6)); | 44 content_settings_helper::OriginToString16(kUrl6)); |
40 EXPECT_EQ(L"https://foo.com:81", | 45 EXPECT_EQ(ASCIIToUTF16("https://foo.com:81"), |
41 content_settings_helper::OriginToWString(kUrl7)); | 46 content_settings_helper::OriginToString16(kUrl7)); |
42 } | 47 } |
OLD | NEW |