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

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

Issue 2715243004: [blink] Support (semi-)transparent background colors in WebView/Frame. (Closed)
Patch Set: add unit test for remote frame transparency Created 3 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
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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 baseURL); 427 baseURL);
428 // Expected: transparent on top of kTransparent will still be transparent. 428 // Expected: transparent on top of kTransparent will still be transparent.
429 EXPECT_EQ(kTransparent, webView->backgroundColor()); 429 EXPECT_EQ(kTransparent, webView->backgroundColor());
430 430
431 LocalFrame* frame = webView->mainFrameImpl()->frame(); 431 LocalFrame* frame = webView->mainFrameImpl()->frame();
432 // The shutdown() calls are a hack to prevent this test 432 // The shutdown() calls are a hack to prevent this test
433 // from violating invariants about frame state during navigation/detach. 433 // from violating invariants about frame state during navigation/detach.
434 frame->document()->shutdown(); 434 frame->document()->shutdown();
435 435
436 // Creating a new frame view with the background color having 0 alpha. 436 // Creating a new frame view with the background color having 0 alpha.
437 frame->createView(IntSize(1024, 768), Color::transparent, true); 437 frame->createView(IntSize(1024, 768), Color::transparent);
438 EXPECT_EQ(kTransparent, frame->view()->baseBackgroundColor()); 438 EXPECT_EQ(kTransparent, frame->view()->baseBackgroundColor());
439 frame->view()->dispose(); 439 frame->view()->dispose();
440 440
441 const Color transparentRed(100, 0, 0, 0); 441 const Color transparentRed(100, 0, 0, 0);
442 frame->createView(IntSize(1024, 768), transparentRed, true); 442 frame->createView(IntSize(1024, 768), transparentRed);
443 EXPECT_EQ(transparentRed, frame->view()->baseBackgroundColor()); 443 EXPECT_EQ(transparentRed, frame->view()->baseBackgroundColor());
444 frame->view()->dispose(); 444 frame->view()->dispose();
445 } 445 }
446 446
447 TEST_P(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) { 447 TEST_P(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) {
448 const WebColor kBlue = 0xFF0000FF; 448 const WebColor kBlue = 0xFF0000FF;
449 FrameTestHelpers::TestWebViewClient webViewClient; 449 FrameTestHelpers::TestWebViewClient webViewClient;
450 WebViewImpl* webView = 450 WebViewImpl* webView =
451 WebViewImpl::create(&webViewClient, WebPageVisibilityStateVisible); 451 WebViewImpl::create(&webViewClient, WebPageVisibilityStateVisible);
452 EXPECT_NE(kBlue, webView->backgroundColor()); 452 EXPECT_NE(kBlue, webView->backgroundColor());
(...skipping 3974 matching lines...) Expand 10 before | Expand all | Expand 10 after
4427 EXPECT_FALSE(frameView->visualViewportSuppliesScrollbars()); 4427 EXPECT_FALSE(frameView->visualViewportSuppliesScrollbars());
4428 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 4428 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
4429 EXPECT_NE(nullptr, 4429 EXPECT_NE(nullptr,
4430 frameView->layoutViewportScrollableArea()->verticalScrollbar()); 4430 frameView->layoutViewportScrollableArea()->verticalScrollbar());
4431 } else { 4431 } else {
4432 EXPECT_NE(nullptr, frameView->verticalScrollbar()); 4432 EXPECT_NE(nullptr, frameView->verticalScrollbar());
4433 } 4433 }
4434 } 4434 }
4435 4435
4436 } // namespace blink 4436 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698