Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "sandbox/win/src/sandbox_types.h" | 5 #include "sandbox/win/src/sandbox_types.h" |
| 6 #include "sandbox/win/src/sandbox_nt_types.h" | 6 #include "sandbox/win/src/sandbox_nt_types.h" |
| 7 #include "sandbox/win/src/policy_engine_params.h" | 7 #include "sandbox/win/src/policy_engine_params.h" |
| 8 #include "sandbox/win/src/policy_engine_opcodes.h" | 8 #include "sandbox/win/src/policy_engine_opcodes.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 EXPECT_EQ(24, mc1.position); | 282 EXPECT_EQ(24, mc1.position); |
| 283 | 283 |
| 284 // Test that we don't match because it is not at the end of the string | 284 // Test that we don't match because it is not at the end of the string |
| 285 PolicyOpcode* op5b = opcode_maker.MakeOpWStringMatch(0, txt5, kSeekToEnd, | 285 PolicyOpcode* op5b = opcode_maker.MakeOpWStringMatch(0, txt5, kSeekToEnd, |
| 286 CASE_SENSITIVE, | 286 CASE_SENSITIVE, |
| 287 kPolNone); | 287 kPolNone); |
| 288 EXPECT_EQ(EVAL_FALSE, op5b->Evaluate(&pp_tc1, 1, &mc1)); | 288 EXPECT_EQ(EVAL_FALSE, op5b->Evaluate(&pp_tc1, 1, &mc1)); |
| 289 | 289 |
| 290 // Test that we function if the string does not fit. In this case we | 290 // Test that we function if the string does not fit. In this case we |
| 291 // try to match 'the lazy dog' against 'he lazy dog'. | 291 // try to match 'the lazy dog' against 'he lazy dog'. |
| 292 PolicyOpcode* op6 = opcode_maker.MakeOpWStringMatch(0, txt4, 2, | 292 // !!! Are we supposed to Evaluate() this opcode and test the result? |
|
Peter Kasting
2014/09/29 23:09:25
This question needs answering before this CL can b
cpu_(ooo_6.6-7.5)
2014/09/30 17:57:26
Yes, looks like somebody forgot to call evaluate()
Peter Kasting
2014/10/01 02:32:13
Fixed.
| |
| 293 /*PolicyOpcode* op6 =*/ opcode_maker.MakeOpWStringMatch(0, txt4, 2, | |
| 293 CASE_SENSITIVE, kPolNone); | 294 CASE_SENSITIVE, kPolNone); |
| 294 EXPECT_EQ(24, mc1.position); | 295 EXPECT_EQ(24, mc1.position); |
| 295 | 296 |
| 296 // Testing matching against 'g' which should be the last char. | 297 // Testing matching against 'g' which should be the last char. |
| 297 MatchContext mc2; | 298 MatchContext mc2; |
| 298 PolicyOpcode* op7 = opcode_maker.MakeOpWStringMatch(0, txt6, kSeekForward, | 299 PolicyOpcode* op7 = opcode_maker.MakeOpWStringMatch(0, txt6, kSeekForward, |
| 299 CASE_SENSITIVE, kPolNone); | 300 CASE_SENSITIVE, kPolNone); |
| 300 EXPECT_EQ(EVAL_TRUE, op7->Evaluate(&pp_tc1, 1, &mc2)); | 301 EXPECT_EQ(EVAL_TRUE, op7->Evaluate(&pp_tc1, 1, &mc2)); |
| 301 | 302 |
| 302 // Trying to match again should fail since we are in the last char. | 303 // Trying to match again should fail since we are in the last char. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 MatchContext mc1; | 335 MatchContext mc1; |
| 335 void* dummy = NULL; | 336 void* dummy = NULL; |
| 336 ParameterSet ppb1 = ParamPickerMake(dummy); | 337 ParameterSet ppb1 = ParamPickerMake(dummy); |
| 337 | 338 |
| 338 PolicyOpcode* op1 = opcode_maker.MakeOpAction(ASK_BROKER, kPolNone); | 339 PolicyOpcode* op1 = opcode_maker.MakeOpAction(ASK_BROKER, kPolNone); |
| 339 EXPECT_TRUE(op1->IsAction()); | 340 EXPECT_TRUE(op1->IsAction()); |
| 340 EXPECT_EQ(ASK_BROKER, op1->Evaluate(&ppb1, 1, &mc1)); | 341 EXPECT_EQ(ASK_BROKER, op1->Evaluate(&ppb1, 1, &mc1)); |
| 341 } | 342 } |
| 342 | 343 |
| 343 } // namespace sandbox | 344 } // namespace sandbox |
| OLD | NEW |