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

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

Issue 1052993006: Refactor frame navigation/detach state cleanup to be more sane. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: shuffle Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 webView->setBaseBackgroundColor(kTranslucentPutty); 297 webView->setBaseBackgroundColor(kTranslucentPutty);
298 // Expected: red (50% alpha) blended atop kTranslucentPutty. Note the alpha. 298 // Expected: red (50% alpha) blended atop kTranslucentPutty. Note the alpha.
299 EXPECT_EQ(0xBFE93B32, webView->backgroundColor()); 299 EXPECT_EQ(0xBFE93B32, webView->backgroundColor());
300 300
301 webView->setBaseBackgroundColor(kTransparent); 301 webView->setBaseBackgroundColor(kTransparent);
302 FrameTestHelpers::loadHTMLString(webView->mainFrame(), "<html><head><style>b ody {background-color:transparent}</style></head></html>", baseURL); 302 FrameTestHelpers::loadHTMLString(webView->mainFrame(), "<html><head><style>b ody {background-color:transparent}</style></head></html>", baseURL);
303 // Expected: transparent on top of kTransparent will still be transparent. 303 // Expected: transparent on top of kTransparent will still be transparent.
304 EXPECT_EQ(kTransparent, webView->backgroundColor()); 304 EXPECT_EQ(kTransparent, webView->backgroundColor());
305 305
306 LocalFrame* frame = webView->mainFrameImpl()->frame(); 306 LocalFrame* frame = webView->mainFrameImpl()->frame();
307 // This is a hack to prevent createView() from violating invariants about
308 // frame state during navigation/detach.
309 frame->document()->prepareForDestruction();
307 310
308 // Creating a new frame view with the background color having 0 alpha. 311 // Creating a new frame view with the background color having 0 alpha.
309 frame->createView(IntSize(1024, 768), Color::transparent, true); 312 frame->createView(IntSize(1024, 768), Color::transparent, true);
310 EXPECT_EQ(kTransparent, frame->view()->baseBackgroundColor()); 313 EXPECT_EQ(kTransparent, frame->view()->baseBackgroundColor());
311 314
312 Color kTransparentRed(100, 0, 0, 0); 315 Color kTransparentRed(100, 0, 0, 0);
313 frame->createView(IntSize(1024, 768), kTransparentRed, true); 316 frame->createView(IntSize(1024, 768), kTransparentRed, true);
314 EXPECT_EQ(kTransparentRed, frame->view()->baseBackgroundColor()); 317 EXPECT_EQ(kTransparentRed, frame->view()->baseBackgroundColor());
315 } 318 }
316 319
(...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 // Test without any preventDefault. 2510 // Test without any preventDefault.
2508 client.reset(); 2511 client.reset();
2509 frame->executeScript(WebScriptSource("setTest('none');")); 2512 frame->executeScript(WebScriptSource("setTest('none');"));
2510 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); 2513 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target")));
2511 EXPECT_TRUE(client.getWasCalled()); 2514 EXPECT_TRUE(client.getWasCalled());
2512 2515
2513 m_webViewHelper.reset(); // Remove dependency on locally scoped client. 2516 m_webViewHelper.reset(); // Remove dependency on locally scoped client.
2514 } 2517 }
2515 2518
2516 } // namespace 2519 } // namespace
OLDNEW
« Source/web/tests/PinchViewportTest.cpp ('K') | « Source/web/tests/WebFrameTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698