shdocvw: Fixed race in tests.
authorJacek Caban <jacek@codeweavers.com>
Fri, 12 Nov 2010 13:30:15 +0000 (14:30 +0100)
committerAlexandre Julliard <julliard@winehq.org>
Fri, 12 Nov 2010 14:43:08 +0000 (15:43 +0100)
dlls/shdocvw/tests/webbrowser.c

index babfe11293782ae242a93e30937b764e6d6f7b0d..1b1afc159b4bf4f22d458a4269b87bb407d25cff 100644 (file)
@@ -118,6 +118,8 @@ DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_0);
 DEFINE_EXPECT(Exec_SETDOWNLOADSTATE_1);
 DEFINE_EXPECT(Exec_SETPROGRESSMAX);
 DEFINE_EXPECT(Exec_SETPROGRESSPOS);
+DEFINE_EXPECT(Exec_UPDATECOMMANDS);
+DEFINE_EXPECT(Exec_SETTITLE);
 DEFINE_EXPECT(QueryStatus_SETPROGRESSTEXT);
 DEFINE_EXPECT(QueryStatus_STOP);
 DEFINE_EXPECT(DocHost_EnableModeless_TRUE);
@@ -285,6 +287,16 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID
                 ok(0, "unexpevted V_I4(pvaIn)=%d\n", V_I4(pvaIn));
             }
             return S_OK;
+        case OLECMDID_UPDATECOMMANDS:
+            CHECK_EXPECT(Exec_UPDATECOMMANDS);
+            ok(nCmdexecopt == OLECMDEXECOPT_DONTPROMPTUSER, "nCmdexecopts=%08x\n", nCmdexecopt);
+            ok(!pvaIn, "pvaIn != NULL\n");
+            ok(!pvaOut, "pvaOut=%p, expected NULL\n", pvaOut);
+            return S_OK;
+        case OLECMDID_SETTITLE:
+            CHECK_EXPECT(Exec_SETTITLE);
+            /* TODO: test args */
+            return S_OK;
         default:
             ok(0, "unexpected nsCmdID %d\n", nCmdID);
         }
@@ -2250,9 +2262,7 @@ static void test_download(DWORD flags)
     SET_EXPECT(Invoke_STATUSTEXTCHANGE);
     SET_EXPECT(SetStatusText);
     SET_EXPECT(EnableModeless_TRUE);
-    if(is_first_load)
-        SET_EXPECT(QueryStatus_STOP);
-    else
+    if(!is_first_load)
         SET_EXPECT(GetHostInfo);
     SET_EXPECT(Exec_SETDOWNLOADSTATE_0);
     SET_EXPECT(Invoke_TITLECHANGE);
@@ -2261,6 +2271,11 @@ static void test_download(DWORD flags)
         SET_EXPECT(GetDropTarget);
     SET_EXPECT(Invoke_PROGRESSCHANGE);
     SET_EXPECT(Invoke_DOCUMENTCOMPLETE);
+
+    SET_EXPECT(UpdateUI);
+    SET_EXPECT(Exec_UPDATECOMMANDS);
+    SET_EXPECT(QueryStatus_STOP);
+
     while(!called_Invoke_DOCUMENTCOMPLETE && GetMessage(&msg, NULL, 0, 0)) {
         TranslateMessage(&msg);
         DispatchMessage(&msg);
@@ -2289,9 +2304,7 @@ static void test_download(DWORD flags)
         todo_wine CHECK_CALLED(EnableModeless_TRUE);
     else
         CLEAR_CALLED(EnableModeless_FALSE); /* IE 8 */
-    if(is_first_load)
-        todo_wine CHECK_CALLED(QueryStatus_STOP);
-    else
+    if(!is_first_load)
         todo_wine CHECK_CALLED(GetHostInfo);
     todo_wine CHECK_CALLED(Exec_SETDOWNLOADSTATE_0);
     todo_wine CHECK_CALLED(Invoke_TITLECHANGE);
@@ -2304,6 +2317,15 @@ static void test_download(DWORD flags)
     is_downloading = FALSE;
 
     test_ready_state(READYSTATE_COMPLETE);
+
+    while(!called_Exec_UPDATECOMMANDS && GetMessage(&msg, NULL, 0, 0)) {
+        TranslateMessage(&msg);
+        DispatchMessage(&msg);
+    }
+
+    CHECK_CALLED(UpdateUI);
+    CHECK_CALLED(Exec_UPDATECOMMANDS);
+    CLEAR_CALLED(QueryStatus_STOP);
 }
 
 static void test_olecmd(IUnknown *unk, BOOL loaded)