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

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

Issue 2651583007: Plumbing blink::Interface{Provider|Registry} through WebLocalFrame's constructor. (Closed)
Patch Set: ScreenWakeLockTest Created 3 years, 11 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 const WebColor kBlue = 0xFF0000FF; 430 const WebColor kBlue = 0xFF0000FF;
431 FrameTestHelpers::TestWebViewClient webViewClient; 431 FrameTestHelpers::TestWebViewClient webViewClient;
432 WebViewImpl* webView = 432 WebViewImpl* webView =
433 WebViewImpl::create(&webViewClient, WebPageVisibilityStateVisible); 433 WebViewImpl::create(&webViewClient, WebPageVisibilityStateVisible);
434 EXPECT_NE(kBlue, webView->backgroundColor()); 434 EXPECT_NE(kBlue, webView->backgroundColor());
435 // webView does not have a frame yet, but we should still be able to set the 435 // webView does not have a frame yet, but we should still be able to set the
436 // background color. 436 // background color.
437 webView->setBaseBackgroundColor(kBlue); 437 webView->setBaseBackgroundColor(kBlue);
438 EXPECT_EQ(kBlue, webView->backgroundColor()); 438 EXPECT_EQ(kBlue, webView->backgroundColor());
439 FrameTestHelpers::TestWebFrameClient webFrameClient; 439 FrameTestHelpers::TestWebFrameClient webFrameClient;
440 WebLocalFrame* frame = 440 WebLocalFrame* frame = WebLocalFrame::create(
441 WebLocalFrame::create(WebTreeScopeType::Document, &webFrameClient); 441 WebTreeScopeType::Document, &webFrameClient, nullptr, nullptr);
442 webView->setMainFrame(frame); 442 webView->setMainFrame(frame);
443 webView->close(); 443 webView->close();
444 } 444 }
445 445
446 TEST_P(WebViewTest, SetBaseBackgroundColorAndBlendWithExistingContent) { 446 TEST_P(WebViewTest, SetBaseBackgroundColorAndBlendWithExistingContent) {
447 const WebColor kAlphaRed = 0x80FF0000; 447 const WebColor kAlphaRed = 0x80FF0000;
448 const WebColor kAlphaGreen = 0x8000FF00; 448 const WebColor kAlphaGreen = 0x8000FF00;
449 const int kWidth = 100; 449 const int kWidth = 100;
450 const int kHeight = 100; 450 const int kHeight = 100;
451 451
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
2143 2143
2144 // Explicitly reset to break dependency on locally scoped client. 2144 // Explicitly reset to break dependency on locally scoped client.
2145 m_webViewHelper.reset(); 2145 m_webViewHelper.reset();
2146 } 2146 }
2147 2147
2148 TEST_P(WebViewTest, ClientTapHandlingNullWebViewClient) { 2148 TEST_P(WebViewTest, ClientTapHandlingNullWebViewClient) {
2149 WebViewImpl* webView = 2149 WebViewImpl* webView =
2150 WebViewImpl::create(nullptr, WebPageVisibilityStateVisible); 2150 WebViewImpl::create(nullptr, WebPageVisibilityStateVisible);
2151 FrameTestHelpers::TestWebFrameClient webFrameClient; 2151 FrameTestHelpers::TestWebFrameClient webFrameClient;
2152 FrameTestHelpers::TestWebWidgetClient webWidgetClient; 2152 FrameTestHelpers::TestWebWidgetClient webWidgetClient;
2153 WebLocalFrame* localFrame = 2153 WebLocalFrame* localFrame = WebLocalFrame::create(
2154 WebLocalFrame::create(WebTreeScopeType::Document, &webFrameClient); 2154 WebTreeScopeType::Document, &webFrameClient, nullptr, nullptr);
2155 webView->setMainFrame(localFrame); 2155 webView->setMainFrame(localFrame);
2156 2156
2157 // TODO(dcheng): The main frame widget currently has a special case. 2157 // TODO(dcheng): The main frame widget currently has a special case.
2158 // Eliminate this once WebView is no longer a WebWidget. 2158 // Eliminate this once WebView is no longer a WebWidget.
2159 blink::WebFrameWidget::create(&webWidgetClient, webView, localFrame); 2159 blink::WebFrameWidget::create(&webWidgetClient, webView, localFrame);
2160 2160
2161 WebGestureEvent event(WebInputEvent::GestureTap, WebInputEvent::NoModifiers, 2161 WebGestureEvent event(WebInputEvent::GestureTap, WebInputEvent::NoModifiers,
2162 WebInputEvent::TimeStampForTesting); 2162 WebInputEvent::TimeStampForTesting);
2163 event.sourceDevice = WebGestureDeviceTouchscreen; 2163 event.sourceDevice = WebGestureDeviceTouchscreen;
2164 event.x = 3; 2164 event.x = 3;
(...skipping 2210 matching lines...) Expand 10 before | Expand all | Expand 10 after
4375 EXPECT_EQ(expectedWidth, vwElement->offsetWidth()); 4375 EXPECT_EQ(expectedWidth, vwElement->offsetWidth());
4376 EXPECT_EQ(expectedHeight, vwElement->offsetHeight()); 4376 EXPECT_EQ(expectedHeight, vwElement->offsetHeight());
4377 4377
4378 webView->resize(WebSize(800, 600)); 4378 webView->resize(WebSize(800, 600));
4379 frame->printEnd(); 4379 frame->printEnd();
4380 4380
4381 EXPECT_EQ(800, vwElement->offsetWidth()); 4381 EXPECT_EQ(800, vwElement->offsetWidth());
4382 } 4382 }
4383 4383
4384 } // namespace blink 4384 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698