Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(905)

Unified Diff: chrome_frame/test/ui_test.cc

Issue 9323025: Fix races in CFTxtFieldUndo and CFTxtFieldRedo tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/test/ui_test.cc
diff --git a/chrome_frame/test/ui_test.cc b/chrome_frame/test/ui_test.cc
index c5bd340cc0b5b5729edc02828f61920331652371..86fc3029a5c5abc4e7dad94d38753f3c626a045d 100644
--- a/chrome_frame/test/ui_test.cc
+++ b/chrome_frame/test/ui_test.cc
@@ -868,13 +868,16 @@ TEST_F(ContextMenuTest, CFTxtFieldUndo) {
server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag());
AccObjectMatcher txtfield_matcher(L"", L"editable text");
- // Change the value of text field to 'A', then invoke 'Undo' context menu item
- // of text field.
+ // Change the value of text field to 'A'.
EXPECT_CALL(acc_observer_,
OnAccDocLoad(TabContentsTitleEq(context_menu_page_title)))
.WillOnce(testing::DoAll(
- AccSendCharMessage(txtfield_matcher, L'A'),
- AccRightClick(txtfield_matcher)));
+ AccWatchForOneValueChange(&acc_observer_, txtfield_matcher),
+ AccSendCharMessage(txtfield_matcher, L'A')));
+ // Bring up the context menu once the value has changed.
+ EXPECT_CALL(acc_observer_, OnAccValueChange(_, _, StrEq(L"A")))
+ .WillOnce(AccRightClick(txtfield_matcher));
+ // Then select "Undo".
EXPECT_CALL(acc_observer_, OnMenuPopup(_))
.WillOnce(testing::DoAll(
AccWatchForOneValueChange(&acc_observer_, txtfield_matcher),
@@ -893,27 +896,31 @@ TEST_F(ContextMenuTest, CFTxtFieldRedo) {
AccObjectMatcher txtfield_matcher(L"", L"editable text");
InSequence expect_in_sequence_for_scope;
- // Change text field value to 'A', then undo it.
+ // Change text field from its initial value to 'A'.
EXPECT_CALL(acc_observer_,
OnAccDocLoad(TabContentsTitleEq(context_menu_page_title)))
.WillOnce(testing::DoAll(
- AccSendCharMessage(txtfield_matcher, L'A'),
- AccRightClick(txtfield_matcher)));
+ AccWatchForOneValueChange(&acc_observer_, txtfield_matcher),
+ AccSendCharMessage(txtfield_matcher, L'A')));
+ // Bring up the context menu.
+ EXPECT_CALL(acc_observer_, OnAccValueChange(_, _, StrEq(L"A")))
+ .WillOnce(AccRightClick(txtfield_matcher));
+ // Select "Undo"
EXPECT_CALL(acc_observer_, OnMenuPopup(_))
.WillOnce(testing::DoAll(
AccWatchForOneValueChange(&acc_observer_, txtfield_matcher),
AccLeftClick(AccObjectMatcher(L"Undo*"))));
- // After undo operation is done, invoke 'Redo' context menu item.
+ // After undo operation is done, bring up the context menu again.
EXPECT_CALL(acc_observer_, OnAccValueChange(_, _, StrEq(kTextFieldInitValue)))
- .WillOnce(testing::DoAll(
- AccRightClick(txtfield_matcher),
- AccWatchForOneValueChange(&acc_observer_, txtfield_matcher)));
+ .WillOnce(AccRightClick(txtfield_matcher));
+ // Select "Redo"
EXPECT_CALL(acc_observer_, OnMenuPopup(_))
- .WillOnce(AccLeftClick(AccObjectMatcher(L"Redo*")));
+ .WillOnce(testing::DoAll(
+ AccWatchForOneValueChange(&acc_observer_, txtfield_matcher),
+ AccLeftClick(AccObjectMatcher(L"Redo*"))));
- // After redo operation is done, verify that text field value is reset to its
- // changed value 'A'.
+ // Verify that text field value is reset to its changed value 'A' and exit.
EXPECT_CALL(acc_observer_, OnAccValueChange(_, _, StrEq(L"A")))
.WillOnce(CloseBrowserMock(&ie_mock_));
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698