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

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 229043004: Fixed crash in WebFrameImpl::resetMatchCount function. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added delay Created 6 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 3397 matching lines...) Expand 10 before | Expand all | Expand 10 after
3408 3408
3409 // The first scopeStringMatches will have reset the state. Detach before it actually scopes. 3409 // The first scopeStringMatches will have reset the state. Detach before it actually scopes.
3410 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); 3410 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove());
3411 3411
3412 runPendingTasks(); 3412 runPendingTasks();
3413 EXPECT_TRUE(client.findResultsAreReady()); 3413 EXPECT_TRUE(client.findResultsAreReady());
3414 3414
3415 holdSecondFrame.release(); 3415 holdSecondFrame.release();
3416 } 3416 }
3417 3417
3418 TEST_F(WebFrameTest, ResetMatchCount)
3419 {
3420 registerMockedHttpURLLoad("find_in_generated_frame.html");
3421
3422 FindUpdateWebFrameClient client;
3423 FrameTestHelpers::WebViewHelper webViewHelper;
3424 webViewHelper.initializeAndLoad(m_baseURL + "find_in_generated_frame.html", true, &client);
3425 webViewHelper.webView()->resize(WebSize(640, 480));
3426 webViewHelper.webView()->layout();
3427 runPendingTasks();
3428
3429 static const char* kFindString = "result";
3430 static const int kFindIdentifier = 12345;
3431
3432 WebFindOptions options;
3433 WebString searchText = WebString::fromUTF8(kFindString);
3434 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()-> mainFrame());
3435
3436 class DelayedTask : public WebThread::Task {
3437 virtual void run()
3438 {
3439 Platform::current()->currentThread()->exitRunLoop();
3440 }
3441 };
3442 // We should wait a bit until JS setTimeout() task is completed.
3443 Platform::current()->currentThread()->postDelayedTask(new DelayedTask(), 100 );
3444 Platform::current()->currentThread()->enterRunLoop();
3445
3446 // Check that frame was generated by script.
3447 EXPECT_TRUE(!!mainFrame->traverseNext(false));
3448
3449 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) {
3450 EXPECT_FALSE(frame->find(kFindIdentifier, searchText, options, false, 0) );
3451 }
3452
3453 runPendingTasks();
3454 EXPECT_FALSE(client.findResultsAreReady());
3455
3456 mainFrame->resetMatchCount();
3457 }
3458
3418 TEST_F(WebFrameTest, SetTickmarks) 3459 TEST_F(WebFrameTest, SetTickmarks)
3419 { 3460 {
3420 registerMockedHttpURLLoad("find.html"); 3461 registerMockedHttpURLLoad("find.html");
3421 3462
3422 FindUpdateWebFrameClient client; 3463 FindUpdateWebFrameClient client;
3423 FrameTestHelpers::WebViewHelper webViewHelper; 3464 FrameTestHelpers::WebViewHelper webViewHelper;
3424 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); 3465 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client);
3425 webViewHelper.webView()->resize(WebSize(640, 480)); 3466 webViewHelper.webView()->resize(WebSize(640, 480));
3426 webViewHelper.webView()->layout(); 3467 webViewHelper.webView()->layout();
3427 runPendingTasks(); 3468 runPendingTasks();
(...skipping 1992 matching lines...) Expand 10 before | Expand all | Expand 10 after
5420 registerMockedHttpURLLoad("link-manifest-change.html"); 5461 registerMockedHttpURLLoad("link-manifest-change.html");
5421 5462
5422 ManifestChangeWebFrameClient webFrameClient; 5463 ManifestChangeWebFrameClient webFrameClient;
5423 FrameTestHelpers::WebViewHelper webViewHelper; 5464 FrameTestHelpers::WebViewHelper webViewHelper;
5424 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); 5465 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient);
5425 5466
5426 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); 5467 EXPECT_EQ(14, webFrameClient.manifestChangeCount());
5427 } 5468 }
5428 5469
5429 } // namespace 5470 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698