diff options
author | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 13:47:13 +0000 |
---|---|---|
committer | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-28 13:47:13 +0000 |
commit | f5d1ea32ea7081621c692e03ae153f74bde105b3 (patch) | |
tree | 6f508b877d92d3d3dccab58dc49284434c5b9cd3 /chrome_frame/test/ui_test.cc | |
parent | 2014db003dcdc6e45aed7ba6d5e51819354ef66a (diff) | |
download | chromium_src-f5d1ea32ea7081621c692e03ae153f74bde105b3.zip chromium_src-f5d1ea32ea7081621c692e03ae153f74bde105b3.tar.gz chromium_src-f5d1ea32ea7081621c692e03ae153f74bde105b3.tar.bz2 |
This changelist consists of a test for the Delete Browsing History feature.
The feature was never covered by automated tests, and a recent changelist addressed a bug in the feature (http://codereview.chromium.org/3167040).
The test validates the following:
1) That cached files are re-retrieved after the user requests their deletion.
2) That saved form data is deleted after the user requests its deletion.
3) That Chrome Frame tabs do not crash when the user deletes browsing history.
BUG=56212
TEST= (1) Run "chrome_frame_tests.exe --gclient_filter=DeleteBro*" (should pass) (2) Run the test, and immediately lock your workstation before it starts. It should still pass. (3) Comment out the call to RemoveBrowsingData in DeleteChromeHistory::OnAutomationServerReady (chrome_frame/delete_chrome_history.cc) and run the test. It fails. (4) Revert changes from 3, comment out the check for low integrity level in DeleteChromeHistory::DeleteBrowsingHistory (same file) and run the test. It fails.
Review URL: http://codereview.chromium.org/3365010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60779 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test/ui_test.cc')
-rw-r--r-- | chrome_frame/test/ui_test.cc | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/chrome_frame/test/ui_test.cc b/chrome_frame/test/ui_test.cc index 54fd0d2..6224d80 100644 --- a/chrome_frame/test/ui_test.cc +++ b/chrome_frame/test/ui_test.cc @@ -112,23 +112,23 @@ TEST_P(FullTabUITest, FLAKY_CtrlN) { // events for New Window, but for Crl+N we don't get any // OnNewWindowX notifications. :( MockWindowObserver win_observer_mock; - const wchar_t* kIEFrameClass = L"IEFrame"; + + const char* kNewWindowTitlePattern = "*Internet Explorer*"; EXPECT_CALL(ie_mock_, OnLoad(is_cf, StrEq(GetSimplePageUrl()))) .WillOnce(testing::DoAll( - WatchWindow(&win_observer_mock, kIEFrameClass), + WatchWindow(&win_observer_mock, kNewWindowTitlePattern), SetFocusToRenderer(&ie_mock_), DelaySendChar(&loop_, 1000, 'n', simulate_input::CONTROL))); - // Watch for new window - const char* kNewWindowTitle = "Internet Explorer"; - EXPECT_CALL(win_observer_mock, - OnWindowDetected(_, testing::HasSubstr(kNewWindowTitle))) - .WillOnce(testing::DoAll( - DoCloseWindow(), - CloseBrowserMock(&ie_mock_))); + // Watch for new window. It appears that the window close message cannot be + // reliably delivered immediately upon receipt of the window open event. + EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) + .WillOnce(DelayDoCloseWindow(500)); + + EXPECT_CALL(win_observer_mock, OnWindowClose(_)) + .WillOnce(CloseBrowserMock(&ie_mock_)); LaunchIEAndNavigate(GetSimplePageUrl()); - // TODO(kkania): The new window does not close properly sometimes. } // Test that ctrl+r does cause a refresh. @@ -389,20 +389,20 @@ TEST_F(ContextMenuTest, CFPageInfo) { InSequence expect_in_sequence_for_scope; // View page information. - const wchar_t* kPageInfoWindowClass = L"Chrome_WidgetWin_0"; + const char* kPageInfoCaption = "Security Information"; EXPECT_CALL(acc_observer_, OnAccDocLoad(_)) .WillOnce(testing::DoAll( - WatchWindow(&win_observer_mock, kPageInfoWindowClass), + WatchWindow(&win_observer_mock, kPageInfoCaption), OpenContextMenuAsync())); EXPECT_CALL(acc_observer_, OnMenuPopup(_)) .WillOnce(AccLeftClick(AccObjectMatcher(L"View page info"))); // Expect page info dialog to pop up. Dismiss the dialog with 'Esc' key - const char* kPageInfoCaption = "Security Information"; - EXPECT_CALL(win_observer_mock, OnWindowDetected(_, StrEq(kPageInfoCaption))) - .WillOnce(testing::DoAll( - DoCloseWindow(), - CloseBrowserMock(&ie_mock_))); + EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) + .WillOnce(DoCloseWindow()); + + EXPECT_CALL(win_observer_mock, OnWindowClose(_)) + .WillOnce(CloseBrowserMock(&ie_mock_)); LaunchIEAndNavigate(GetSimplePageUrl()); } @@ -413,22 +413,20 @@ TEST_F(ContextMenuTest, CFInspector) { InSequence expect_in_sequence_for_scope; // Open developer tools. - const wchar_t* kPageInfoWindowClass = L"Chrome_WidgetWin_0"; + // Devtools begins life with "Untitled" caption and it changes + // later to the 'Developer Tools - <url> form. + const char* kPageInfoCaptionPattern = "Untitled*"; EXPECT_CALL(acc_observer_, OnAccDocLoad(_)) .WillOnce(testing::DoAll( - WatchWindow(&win_observer_mock, kPageInfoWindowClass), + WatchWindow(&win_observer_mock, kPageInfoCaptionPattern), OpenContextMenuAsync())); EXPECT_CALL(acc_observer_, OnMenuPopup(_)) .WillOnce(AccLeftClick(AccObjectMatcher(L"Inspect element"))); - // Devtools begins life with "Untitled" caption and it changes - // later to the 'Developer Tools - <url> form. - const char* kPageInfoCaption = "Untitled"; - EXPECT_CALL(win_observer_mock, - OnWindowDetected(_, testing::StartsWith(kPageInfoCaption))) - .WillOnce(testing::DoAll( - DelayDoCloseWindow(5000), // wait to catch possible crash - DelayCloseBrowserMock(&loop_, 5500, &ie_mock_))); + EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) + .WillOnce(DelayDoCloseWindow(5000)); // wait to catch possible crash + EXPECT_CALL(win_observer_mock, OnWindowClose(_)) + .WillOnce(CloseBrowserMock(&ie_mock_)); LaunchIENavigateAndLoop(GetSimplePageUrl(), kChromeFrameLongNavigationTimeoutInSeconds * 2); @@ -437,13 +435,14 @@ TEST_F(ContextMenuTest, CFInspector) { TEST_F(ContextMenuTest, CFSaveAs) { server_mock_.ExpectAndServeAnyRequests(CFInvocation::MetaTag()); MockWindowObserver win_observer_mock; + InSequence expect_in_sequence_for_scope; // Open 'Save As' dialog. - const wchar_t* kSaveDlgClass = L"#32770"; + const char* kSaveDlgCaption = "Save As"; EXPECT_CALL(acc_observer_, OnAccDocLoad(_)) .WillOnce(testing::DoAll( - WatchWindow(&win_observer_mock, kSaveDlgClass), + WatchWindow(&win_observer_mock, kSaveDlgCaption), OpenContextMenuAsync())); EXPECT_CALL(acc_observer_, OnMenuPopup(_)) .WillOnce(AccLeftClick(AccObjectMatcher(L"Save as..."))); @@ -454,12 +453,14 @@ TEST_F(ContextMenuTest, CFSaveAs) { temp_file_path = temp_file_path.ReplaceExtension(L".htm"); ASSERT_TRUE(file_util::DieFileDie(temp_file_path, false)); - EXPECT_CALL(win_observer_mock, OnWindowDetected(_, StrEq("Save As"))) + EXPECT_CALL(win_observer_mock, OnWindowOpen(_)) .WillOnce(testing::DoAll( AccSetValue(AccObjectMatcher(L"File name:", L"", L"simple*"), - temp_file_path.value()), - AccDoDefaultAction(AccObjectMatcher(L"Save", L"push button")), - CloseWhenFileSaved(&ie_mock_, temp_file_path, 5000))); + temp_file_path.value()), + AccDoDefaultAction(AccObjectMatcher(L"Save", L"push button")))); + + EXPECT_CALL(win_observer_mock, OnWindowClose(_)) + .WillOnce(CloseWhenFileSaved(&ie_mock_, temp_file_path, 5000)); LaunchIENavigateAndLoop(GetSimplePageUrl(), kChromeFrameLongNavigationTimeoutInSeconds * 2); |