OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/common/extensions/extension_unittest.h" | 9 #include "chrome/common/extensions/extension_unittest.h" |
10 #include "chrome/common/extensions/permissions/socket_permission.h" | 10 #include "chrome/common/extensions/permissions/socket_permission.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 CHECK(data1.ParseForTest("tcp-connect")); | 41 CHECK(data1.ParseForTest("tcp-connect")); |
42 CHECK(data2.ParseForTest("tcp-connect:www.example.com")); | 42 CHECK(data2.ParseForTest("tcp-connect:www.example.com")); |
43 | 43 |
44 EXPECT_FALSE(data1 == data2); | 44 EXPECT_FALSE(data1 == data2); |
45 EXPECT_TRUE(data1 < data2); | 45 EXPECT_TRUE(data1 < data2); |
46 } | 46 } |
47 | 47 |
48 TEST_F(SocketPermissionTest, Parse) { | 48 TEST_F(SocketPermissionTest, Parse) { |
49 SocketPermissionData data; | 49 SocketPermissionData data; |
50 | 50 |
51 EXPECT_FALSE(data.ParseForTest("")); | 51 EXPECT_FALSE(data.ParseForTest(std::string())); |
52 EXPECT_FALSE(data.ParseForTest("*")); | 52 EXPECT_FALSE(data.ParseForTest("*")); |
53 EXPECT_FALSE(data.ParseForTest("\00\00*")); | 53 EXPECT_FALSE(data.ParseForTest("\00\00*")); |
54 EXPECT_FALSE(data.ParseForTest("\01*")); | 54 EXPECT_FALSE(data.ParseForTest("\01*")); |
55 EXPECT_FALSE(data.ParseForTest("tcp-connect:www.example.com:-1")); | 55 EXPECT_FALSE(data.ParseForTest("tcp-connect:www.example.com:-1")); |
56 EXPECT_FALSE(data.ParseForTest("tcp-connect:www.example.com:65536")); | 56 EXPECT_FALSE(data.ParseForTest("tcp-connect:www.example.com:65536")); |
57 EXPECT_FALSE(data.ParseForTest("tcp-connect:::")); | 57 EXPECT_FALSE(data.ParseForTest("tcp-connect:::")); |
58 EXPECT_FALSE(data.ParseForTest("tcp-connect::0")); | 58 EXPECT_FALSE(data.ParseForTest("tcp-connect::0")); |
59 EXPECT_FALSE(data.ParseForTest("tcp-connect: www.exmaple.com: 99 ")); | 59 EXPECT_FALSE(data.ParseForTest("tcp-connect: www.exmaple.com: 99 ")); |
60 EXPECT_FALSE(data.ParseForTest("tcp-connect:*.exmaple.com :99")); | 60 EXPECT_FALSE(data.ParseForTest("tcp-connect:*.exmaple.com :99")); |
61 EXPECT_FALSE(data.ParseForTest("tcp-connect:*.exmaple.com: 99")); | 61 EXPECT_FALSE(data.ParseForTest("tcp-connect:*.exmaple.com: 99")); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 261 |
262 scoped_ptr<base::Value> vtmp(permission1->ToValue()); | 262 scoped_ptr<base::Value> vtmp(permission1->ToValue()); |
263 ASSERT_TRUE(vtmp); | 263 ASSERT_TRUE(vtmp); |
264 ASSERT_TRUE(permission2->FromValue(vtmp.get())); | 264 ASSERT_TRUE(permission2->FromValue(vtmp.get())); |
265 EXPECT_TRUE(permission1->Equal(permission2.get())); | 265 EXPECT_TRUE(permission1->Equal(permission2.get())); |
266 } | 266 } |
267 | 267 |
268 } // namespace | 268 } // namespace |
269 | 269 |
270 } // namespace extensions | 270 } // namespace extensions |
OLD | NEW |