| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 const Color transparentRed(100, 0, 0, 0); | 397 const Color transparentRed(100, 0, 0, 0); |
| 398 frame->createView(IntSize(1024, 768), transparentRed, true); | 398 frame->createView(IntSize(1024, 768), transparentRed, true); |
| 399 EXPECT_EQ(transparentRed, frame->view()->baseBackgroundColor()); | 399 EXPECT_EQ(transparentRed, frame->view()->baseBackgroundColor()); |
| 400 frame->view()->dispose(); | 400 frame->view()->dispose(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 TEST_F(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) | 403 TEST_F(WebViewTest, SetBaseBackgroundColorBeforeMainFrame) |
| 404 { | 404 { |
| 405 const WebColor kBlue = 0xFF0000FF; | 405 const WebColor kBlue = 0xFF0000FF; |
| 406 FrameTestHelpers::TestWebViewClient webViewClient; | 406 FrameTestHelpers::TestWebViewClient webViewClient; |
| 407 WebViewImpl* webView = WebViewImpl::create(&webViewClient); | 407 WebViewImpl* webView = WebViewImpl::create(&webViewClient, WebPageVisibility
StateVisible); |
| 408 EXPECT_NE(kBlue, webView->backgroundColor()); | 408 EXPECT_NE(kBlue, webView->backgroundColor()); |
| 409 // webView does not have a frame yet, but we should still be able to set the
background color. | 409 // webView does not have a frame yet, but we should still be able to set the
background color. |
| 410 webView->setBaseBackgroundColor(kBlue); | 410 webView->setBaseBackgroundColor(kBlue); |
| 411 EXPECT_EQ(kBlue, webView->backgroundColor()); | 411 EXPECT_EQ(kBlue, webView->backgroundColor()); |
| 412 WebLocalFrame* frame = WebLocalFrame::create(WebTreeScopeType::Document, nul
lptr); | 412 WebLocalFrame* frame = WebLocalFrame::create(WebTreeScopeType::Document, nul
lptr); |
| 413 webView->setMainFrame(frame); | 413 webView->setMainFrame(frame); |
| 414 webView->close(); | 414 webView->close(); |
| 415 frame->close(); | 415 frame->close(); |
| 416 } | 416 } |
| 417 | 417 |
| (...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 webView->handleInputEvent(event); | 1455 webView->handleInputEvent(event); |
| 1456 runPendingTasks(); | 1456 runPendingTasks(); |
| 1457 EXPECT_EQ(25, client.longpressX()); | 1457 EXPECT_EQ(25, client.longpressX()); |
| 1458 EXPECT_EQ(7, client.longpressY()); | 1458 EXPECT_EQ(7, client.longpressY()); |
| 1459 | 1459 |
| 1460 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally
scoped client. | 1460 m_webViewHelper.reset(); // Explicitly reset to break dependency on locally
scoped client. |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient) | 1463 TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient) |
| 1464 { | 1464 { |
| 1465 WebViewImpl* webView = WebViewImpl::create(nullptr); | 1465 WebViewImpl* webView = WebViewImpl::create(nullptr, WebPageVisibilityStateVi
sible); |
| 1466 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, nullptr); | 1466 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, nullptr); |
| 1467 webView->setMainFrame(localFrame); | 1467 webView->setMainFrame(localFrame); |
| 1468 WebGestureEvent event; | 1468 WebGestureEvent event; |
| 1469 event.type = WebInputEvent::GestureTap; | 1469 event.type = WebInputEvent::GestureTap; |
| 1470 event.sourceDevice = WebGestureDeviceTouchscreen; | 1470 event.sourceDevice = WebGestureDeviceTouchscreen; |
| 1471 event.x = 3; | 1471 event.x = 3; |
| 1472 event.y = 8; | 1472 event.y = 8; |
| 1473 EXPECT_EQ(WebInputEventResult::NotHandled, webView->handleInputEvent(event))
; | 1473 EXPECT_EQ(WebInputEventResult::NotHandled, webView->handleInputEvent(event))
; |
| 1474 webView->close(); | 1474 webView->close(); |
| 1475 // Explicitly close as the frame as no frame client to do so on frameDetache
d(). | 1475 // Explicitly close as the frame as no frame client to do so on frameDetache
d(). |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3111 frame->setAutofillClient(&client); | 3111 frame->setAutofillClient(&client); |
| 3112 webView->setInitialFocus(false); | 3112 webView->setInitialFocus(false); |
| 3113 | 3113 |
| 3114 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); | 3114 EXPECT_TRUE(webView->confirmComposition(WebString::fromUTF8(std::string("hel
lo").c_str()))); |
| 3115 EXPECT_EQ(1, client.textChangesFromUserGesture()); | 3115 EXPECT_EQ(1, client.textChangesFromUserGesture()); |
| 3116 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); | 3116 EXPECT_FALSE(UserGestureIndicator::processingUserGesture()); |
| 3117 frame->setAutofillClient(0); | 3117 frame->setAutofillClient(0); |
| 3118 } | 3118 } |
| 3119 | 3119 |
| 3120 } // namespace blink | 3120 } // namespace blink |
| OLD | NEW |