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

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: Clear JS code 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 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 3407
3408 // The first scopeStringMatches will have reset the state. Detach before it actually scopes. 3408 // The first scopeStringMatches will have reset the state. Detach before it actually scopes.
3409 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); 3409 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove());
3410 3410
3411 runPendingTasks(); 3411 runPendingTasks();
3412 EXPECT_TRUE(client.findResultsAreReady()); 3412 EXPECT_TRUE(client.findResultsAreReady());
3413 3413
3414 holdSecondFrame.release(); 3414 holdSecondFrame.release();
3415 } 3415 }
3416 3416
3417 TEST_F(WebFrameTest, ResetMatchCount)
3418 {
3419 registerMockedHttpURLLoad("find_in_generated_frame.html");
3420
3421 FindUpdateWebFrameClient client;
3422 FrameTestHelpers::WebViewHelper webViewHelper;
3423 webViewHelper.initializeAndLoad(m_baseURL + "find_in_generated_frame.html", true, &client);
3424 webViewHelper.webView()->resize(WebSize(640, 480));
3425 webViewHelper.webView()->layout();
3426 runPendingTasks();
3427
3428 static const char* kFindString = "result";
3429 static const int kFindIdentifier = 12345;
3430
3431 WebFindOptions options;
3432 WebString searchText = WebString::fromUTF8(kFindString);
3433 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()-> mainFrame());
3434
3435 // Check that child frame exists.
3436 EXPECT_TRUE(!!mainFrame->traverseNext(false));
3437
3438 for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) {
3439 EXPECT_FALSE(frame->find(kFindIdentifier, searchText, options, false, 0) );
3440 }
3441
3442 runPendingTasks();
3443 EXPECT_FALSE(client.findResultsAreReady());
3444
3445 mainFrame->resetMatchCount();
3446 }
3447
3417 TEST_F(WebFrameTest, SetTickmarks) 3448 TEST_F(WebFrameTest, SetTickmarks)
3418 { 3449 {
3419 registerMockedHttpURLLoad("find.html"); 3450 registerMockedHttpURLLoad("find.html");
3420 3451
3421 FindUpdateWebFrameClient client; 3452 FindUpdateWebFrameClient client;
3422 FrameTestHelpers::WebViewHelper webViewHelper; 3453 FrameTestHelpers::WebViewHelper webViewHelper;
3423 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); 3454 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client);
3424 webViewHelper.webView()->resize(WebSize(640, 480)); 3455 webViewHelper.webView()->resize(WebSize(640, 480));
3425 webViewHelper.webView()->layout(); 3456 webViewHelper.webView()->layout();
3426 runPendingTasks(); 3457 runPendingTasks();
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
5443 registerMockedHttpURLLoad("link-manifest-change.html"); 5474 registerMockedHttpURLLoad("link-manifest-change.html");
5444 5475
5445 ManifestChangeWebFrameClient webFrameClient; 5476 ManifestChangeWebFrameClient webFrameClient;
5446 FrameTestHelpers::WebViewHelper webViewHelper; 5477 FrameTestHelpers::WebViewHelper webViewHelper;
5447 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); 5478 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient);
5448 5479
5449 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); 5480 EXPECT_EQ(14, webFrameClient.manifestChangeCount());
5450 } 5481 }
5451 5482
5452 } // namespace 5483 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698