| OLD | NEW |
| 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 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 const Color transparentRed(100, 0, 0, 0); | 529 const Color transparentRed(100, 0, 0, 0); |
| 530 frame->createView(IntSize(1024, 768), transparentRed, true); | 530 frame->createView(IntSize(1024, 768), transparentRed, true); |
| 531 EXPECT_EQ(transparentRed, frame->view()->baseBackgroundColor()); | 531 EXPECT_EQ(transparentRed, frame->view()->baseBackgroundColor()); |
| 532 frame->view()->dispose(); | 532 frame->view()->dispose(); |
| 533 } | 533 } |
| 534 | 534 |
| 535 TEST_F(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) | 535 TEST_F(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) |
| 536 { | 536 { |
| 537 const WebColor kBlue = 0xFF0000FF; | 537 const WebColor kBlue = 0xFF0000FF; |
| 538 FrameTestHelpers::TestWebViewClient webViewClient; | 538 FrameTestHelpers::TestWebViewClient webViewClient; |
| 539 WebView* webView = WebViewImpl::create(&webViewClient); | 539 WebViewImpl* webView = WebViewImpl::create(&webViewClient); |
| 540 EXPECT_NE(kBlue, webView->backgroundColor()); | 540 EXPECT_NE(kBlue, webView->backgroundColor()); |
| 541 // webView does not have a frame yet, but we should still be able to set the
background color. | 541 // webView does not have a frame yet, but we should still be able to set the
background color. |
| 542 webView->setBaseBackgroundColor(kBlue); | 542 webView->setBaseBackgroundColor(kBlue); |
| 543 EXPECT_EQ(kBlue, webView->backgroundColor()); | 543 EXPECT_EQ(kBlue, webView->backgroundColor()); |
| 544 WebLocalFrameImpl* frame = WebLocalFrameImpl::create(WebTreeScopeType::Docum
ent, nullptr); | 544 WebLocalFrameImpl* frame = WebLocalFrameImpl::create(WebTreeScopeType::Docum
ent, nullptr); |
| 545 webView->setMainFrame(frame); | 545 webView->setMainFrame(frame); |
| 546 webView->close(); | 546 webView->close(); |
| 547 frame->close(); | 547 frame->close(); |
| 548 } | 548 } |
| 549 | 549 |
| 550 TEST_F(WebViewTest, SetBaseBackgroundColorAndBlendWithExistingContent) | 550 TEST_F(WebViewTest, SetBaseBackgroundColorAndBlendWithExistingContent) |
| 551 { | 551 { |
| 552 const WebColor kAlphaRed = 0x80FF0000; | 552 const WebColor kAlphaRed = 0x80FF0000; |
| 553 const WebColor kAlphaGreen = 0x8000FF00; | 553 const WebColor kAlphaGreen = 0x8000FF00; |
| 554 const int kWidth = 100; | 554 const int kWidth = 100; |
| 555 const int kHeight = 100; | 555 const int kHeight = 100; |
| 556 | 556 |
| 557 WebView* webView = m_webViewHelper.initialize(); | 557 WebViewImpl* webView = m_webViewHelper.initialize(); |
| 558 | 558 |
| 559 // Set WebView background to green with alpha. | 559 // Set WebView background to green with alpha. |
| 560 webView->setBaseBackgroundColor(kAlphaGreen); | 560 webView->setBaseBackgroundColor(kAlphaGreen); |
| 561 webView->settings()->setShouldClearDocumentBackground(false); | 561 webView->settings()->setShouldClearDocumentBackground(false); |
| 562 webView->resize(WebSize(kWidth, kHeight)); | 562 webView->resize(WebSize(kWidth, kHeight)); |
| 563 webView->updateAllLifecyclePhases(); | 563 webView->updateAllLifecyclePhases(); |
| 564 | 564 |
| 565 // Set canvas background to red with alpha. | 565 // Set canvas background to red with alpha. |
| 566 SkBitmap bitmap; | 566 SkBitmap bitmap; |
| 567 bitmap.allocN32Pixels(kWidth, kHeight); | 567 bitmap.allocN32Pixels(kWidth, kHeight); |
| (...skipping 2658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3226 frame->setAutofillClient(&client); | 3226 frame->setAutofillClient(&client); |
| 3227 webView->setInitialFocus(false); | 3227 webView->setInitialFocus(false); |
| 3228 | 3228 |
| 3229 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3229 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
| 3230 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3230 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
| 3231 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3231 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 3232 frame->setAutofillClient(0); | 3232 frame->setAutofillClient(0); |
| 3233 } | 3233 } |
| 3234 | 3234 |
| 3235 } // namespace blink | 3235 } // namespace blink |
| OLD | NEW |