Index: third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp |
diff --git a/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp b/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp |
index a2062f9b3a50e0215e84643ce1a615081689fa9a..c009346d469bcd63fe4740bc0d3b412fb1f443b1 100644 |
--- a/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp |
+++ b/third_party/WebKit/Source/core/editing/state_machines/StateMachineTestUtil.cpp |
@@ -5,6 +5,7 @@ |
#include "core/editing/state_machines/StateMachineTestUtil.h" |
#include "core/editing/state_machines/BackwardGraphemeBoundaryStateMachine.h" |
+#include "core/editing/state_machines/ForwardGraphemeBoundaryStateMachine.h" |
#include "core/editing/state_machines/TextSegmentationMachineState.h" |
#include "wtf/Assertions.h" |
#include <algorithm> |
@@ -64,7 +65,8 @@ std::string processSequence(StateMachine* machine, |
break; |
} |
} |
- if (state == TextSegmentationMachineState::NeedMoreCodeUnit) { |
+ if (preceding.empty() |
+ || state == TextSegmentationMachineState::NeedMoreCodeUnit) { |
state = machine->tellEndOfPrecedingText(); |
out += MachineStateToChar(state); |
} |
@@ -95,9 +97,21 @@ std::string processSequenceBackward( |
{ |
const std::string& out = |
processSequence(machine, preceding, std::vector<UChar32>()); |
- DCHECK_EQ(machine->finalizeAndGetBoundaryOffset(), |
- machine->finalizeAndGetBoundaryOffset()) |
- << "finalizeAndGetBoundaryOffset should return fixed values."; |
+ if (machine->finalizeAndGetBoundaryOffset() |
+ != machine->finalizeAndGetBoundaryOffset()) |
+ return "State machine changes final offset after finished."; |
+ return out; |
+} |
+ |
+std::string processSequenceForward( |
+ ForwardGraphemeBoundaryStateMachine* machine, |
+ const std::vector<UChar32>& preceding, |
+ const std::vector<UChar32>& following) |
+{ |
+ const std::string& out = processSequence(machine, preceding, following); |
+ if (machine->finalizeAndGetBoundaryOffset() |
+ != machine->finalizeAndGetBoundaryOffset()) |
+ return "State machine changes final offset after finished."; |
return out; |
} |