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

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

Issue 2547053003: s/ passed(...) / WTF::passed(...) / to avoid future ambiguity w/ base::Passed. (Closed)
Patch Set: Rebasing... Created 4 years 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // Suspend scheduled tasks so the script doesn't run. 515 // Suspend scheduled tasks so the script doesn't run.
516 WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl(); 516 WebLocalFrameImpl* mainFrame = webViewHelper.webView()->mainFrameImpl();
517 Document* document = mainFrame->frame()->document(); 517 Document* document = mainFrame->frame()->document();
518 document->suspendScheduledTasks(); 518 document->suspendScheduledTasks();
519 519
520 v8::HandleScope scope(v8::Isolate::GetCurrent()); 520 v8::HandleScope scope(v8::Isolate::GetCurrent());
521 v8::Local<v8::Context> context = 521 v8::Local<v8::Context> context =
522 webViewHelper.webView()->mainFrame()->mainWorldScriptContext(); 522 webViewHelper.webView()->mainFrame()->mainWorldScriptContext();
523 523
524 std::unique_ptr<UserGestureIndicator> indicator = 524 std::unique_ptr<UserGestureIndicator> indicator =
525 wrapUnique(new UserGestureIndicator(DocumentUserGestureToken::create( 525 WTF::wrapUnique(new UserGestureIndicator(DocumentUserGestureToken::create(
526 document, UserGestureToken::NewGesture))); 526 document, UserGestureToken::NewGesture)));
527 ScriptExecutionCallbackHelper callbackHelper(context); 527 ScriptExecutionCallbackHelper callbackHelper(context);
528 v8::Local<v8::Function> function = 528 v8::Local<v8::Function> function =
529 v8::Function::New(context, callback).ToLocalChecked(); 529 v8::Function::New(context, callback).ToLocalChecked();
530 mainFrame->requestExecuteV8Function( 530 mainFrame->requestExecuteV8Function(
531 mainFrame->mainWorldScriptContext(), function, 531 mainFrame->mainWorldScriptContext(), function,
532 v8::Undefined(context->GetIsolate()), 0, nullptr, &callbackHelper); 532 v8::Undefined(context->GetIsolate()), 0, nullptr, &callbackHelper);
533 533
534 runPendingTasks(); 534 runPendingTasks();
535 EXPECT_FALSE(callbackHelper.didComplete()); 535 EXPECT_FALSE(callbackHelper.didComplete());
(...skipping 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after
3102 #else 3102 #else
3103 TEST_F(WebFrameTest, updateOverlayScrollbarLayers) 3103 TEST_F(WebFrameTest, updateOverlayScrollbarLayers)
3104 #endif 3104 #endif
3105 { 3105 {
3106 registerMockedHttpURLLoad("large-div.html"); 3106 registerMockedHttpURLLoad("large-div.html");
3107 3107
3108 int viewWidth = 500; 3108 int viewWidth = 500;
3109 int viewHeight = 500; 3109 int viewHeight = 500;
3110 3110
3111 std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = 3111 std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient =
3112 makeUnique<FakeCompositingWebViewClient>(); 3112 WTF::makeUnique<FakeCompositingWebViewClient>();
3113 FrameTestHelpers::WebViewHelper webViewHelper; 3113 FrameTestHelpers::WebViewHelper webViewHelper;
3114 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), 3114 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(),
3115 nullptr, &configureCompositingWebView); 3115 nullptr, &configureCompositingWebView);
3116 3116
3117 webViewHelper.resize(WebSize(viewWidth, viewHeight)); 3117 webViewHelper.resize(WebSize(viewWidth, viewHeight));
3118 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 3118 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
3119 m_baseURL + "large-div.html"); 3119 m_baseURL + "large-div.html");
3120 3120
3121 FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView(); 3121 FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView();
3122 EXPECT_TRUE( 3122 EXPECT_TRUE(
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
4270 4270
4271 Vector<std::unique_ptr<Notification>> createNotifications; 4271 Vector<std::unique_ptr<Notification>> createNotifications;
4272 Vector<std::unique_ptr<Notification>> releaseNotifications; 4272 Vector<std::unique_ptr<Notification>> releaseNotifications;
4273 4273
4274 private: 4274 private:
4275 void didCreateScriptContext(WebLocalFrame* frame, 4275 void didCreateScriptContext(WebLocalFrame* frame,
4276 v8::Local<v8::Context> context, 4276 v8::Local<v8::Context> context,
4277 int extensionGroup, 4277 int extensionGroup,
4278 int worldId) override { 4278 int worldId) override {
4279 createNotifications.append( 4279 createNotifications.append(
4280 makeUnique<Notification>(frame, context, worldId)); 4280 WTF::makeUnique<Notification>(frame, context, worldId));
4281 } 4281 }
4282 4282
4283 void willReleaseScriptContext(WebLocalFrame* frame, 4283 void willReleaseScriptContext(WebLocalFrame* frame,
4284 v8::Local<v8::Context> context, 4284 v8::Local<v8::Context> context,
4285 int worldId) override { 4285 int worldId) override {
4286 releaseNotifications.append( 4286 releaseNotifications.append(
4287 makeUnique<Notification>(frame, context, worldId)); 4287 WTF::makeUnique<Notification>(frame, context, worldId));
4288 } 4288 }
4289 }; 4289 };
4290 4290
4291 TEST_P(ParameterizedWebFrameTest, ContextNotificationsLoadUnload) { 4291 TEST_P(ParameterizedWebFrameTest, ContextNotificationsLoadUnload) {
4292 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); 4292 v8::HandleScope handleScope(v8::Isolate::GetCurrent());
4293 4293
4294 registerMockedHttpURLLoad("context_notifications_test.html"); 4294 registerMockedHttpURLLoad("context_notifications_test.html");
4295 registerMockedHttpURLLoad("context_notifications_test_frame.html"); 4295 registerMockedHttpURLLoad("context_notifications_test_frame.html");
4296 4296
4297 // Load a frame with an iframe, make sure we get the right create 4297 // Load a frame with an iframe, make sure we get the right create
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
5464 EXPECT_EQ(endRect, initialEndRect); 5464 EXPECT_EQ(endRect, initialEndRect);
5465 } 5465 }
5466 #endif 5466 #endif
5467 5467
5468 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { 5468 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView {
5469 public: 5469 public:
5470 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) {} 5470 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) {}
5471 ~CompositedSelectionBoundsTestLayerTreeView() override {} 5471 ~CompositedSelectionBoundsTestLayerTreeView() override {}
5472 5472
5473 void registerSelection(const WebSelection& selection) override { 5473 void registerSelection(const WebSelection& selection) override {
5474 m_selection = makeUnique<WebSelection>(selection); 5474 m_selection = WTF::makeUnique<WebSelection>(selection);
5475 } 5475 }
5476 5476
5477 void clearSelection() override { 5477 void clearSelection() override {
5478 m_selectionCleared = true; 5478 m_selectionCleared = true;
5479 m_selection.reset(); 5479 m_selection.reset();
5480 } 5480 }
5481 5481
5482 bool getAndResetSelectionCleared() { 5482 bool getAndResetSelectionCleared() {
5483 bool selectionCleared = m_selectionCleared; 5483 bool selectionCleared = m_selectionCleared;
5484 m_selectionCleared = false; 5484 m_selectionCleared = false;
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
7369 FrameTestHelpers::loadFrame(iframe, url2); 7369 FrameTestHelpers::loadFrame(iframe, url2);
7370 EXPECT_EQ(iframe, client.frame()); 7370 EXPECT_EQ(iframe, client.frame());
7371 EXPECT_EQ(url2, iframe->document().url().string().utf8()); 7371 EXPECT_EQ(url2, iframe->document().url().string().utf8());
7372 EXPECT_FALSE(client.replacesCurrentHistoryItem()); 7372 EXPECT_FALSE(client.replacesCurrentHistoryItem());
7373 } 7373 }
7374 7374
7375 // Test verifies that layout will change a layer's scrollable attibutes 7375 // Test verifies that layout will change a layer's scrollable attibutes
7376 TEST_F(WebFrameTest, overflowHiddenRewrite) { 7376 TEST_F(WebFrameTest, overflowHiddenRewrite) {
7377 registerMockedHttpURLLoad("non-scrollable.html"); 7377 registerMockedHttpURLLoad("non-scrollable.html");
7378 std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = 7378 std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient =
7379 makeUnique<FakeCompositingWebViewClient>(); 7379 WTF::makeUnique<FakeCompositingWebViewClient>();
7380 FrameTestHelpers::WebViewHelper webViewHelper; 7380 FrameTestHelpers::WebViewHelper webViewHelper;
7381 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), 7381 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(),
7382 nullptr, &configureCompositingWebView); 7382 nullptr, &configureCompositingWebView);
7383 7383
7384 webViewHelper.resize(WebSize(100, 100)); 7384 webViewHelper.resize(WebSize(100, 100));
7385 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 7385 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
7386 m_baseURL + "non-scrollable.html"); 7386 m_baseURL + "non-scrollable.html");
7387 7387
7388 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); 7388 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor();
7389 ASSERT_TRUE(compositor->scrollLayer()); 7389 ASSERT_TRUE(compositor->scrollLayer());
(...skipping 2998 matching lines...) Expand 10 before | Expand all | Expand 10 after
10388 TestResourcePriorityWebFrameClient() {} 10388 TestResourcePriorityWebFrameClient() {}
10389 10389
10390 void willSendRequest(WebLocalFrame*, WebURLRequest& request) override { 10390 void willSendRequest(WebLocalFrame*, WebURLRequest& request) override {
10391 ExpectedRequest* expectedRequest = m_expectedRequests.get(request.url()); 10391 ExpectedRequest* expectedRequest = m_expectedRequests.get(request.url());
10392 DCHECK(expectedRequest); 10392 DCHECK(expectedRequest);
10393 EXPECT_EQ(expectedRequest->priority, request.getPriority()); 10393 EXPECT_EQ(expectedRequest->priority, request.getPriority());
10394 expectedRequest->seen = true; 10394 expectedRequest->seen = true;
10395 } 10395 }
10396 10396
10397 void addExpectedRequest(const KURL& url, WebURLRequest::Priority priority) { 10397 void addExpectedRequest(const KURL& url, WebURLRequest::Priority priority) {
10398 m_expectedRequests.add(url, makeUnique<ExpectedRequest>(url, priority)); 10398 m_expectedRequests.add(url,
10399 WTF::makeUnique<ExpectedRequest>(url, priority));
10399 } 10400 }
10400 10401
10401 void verifyAllRequests() { 10402 void verifyAllRequests() {
10402 for (const auto& request : m_expectedRequests) 10403 for (const auto& request : m_expectedRequests)
10403 EXPECT_TRUE(request.value->seen); 10404 EXPECT_TRUE(request.value->seen);
10404 } 10405 }
10405 10406
10406 private: 10407 private:
10407 HashMap<KURL, std::unique_ptr<ExpectedRequest>> m_expectedRequests; 10408 HashMap<KURL, std::unique_ptr<ExpectedRequest>> m_expectedRequests;
10408 }; 10409 };
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
11008 11009
11009 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11010 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11010 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11011 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11011 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11012 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11012 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11013 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11013 11014
11014 webViewHelper.reset(); 11015 webViewHelper.reset();
11015 } 11016 }
11016 11017
11017 } // namespace blink 11018 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/tests/VisualViewportTest.cpp ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698