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

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

Issue 2494333002: Replace wrapUnique(new T(args)) by makeUnique<T>(args) in Blink (Closed)
Patch Set: Drop redundant WTF:: Created 4 years, 1 month 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 3085 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 #else 3096 #else
3097 TEST_F(WebFrameTest, updateOverlayScrollbarLayers) 3097 TEST_F(WebFrameTest, updateOverlayScrollbarLayers)
3098 #endif 3098 #endif
3099 { 3099 {
3100 registerMockedHttpURLLoad("large-div.html"); 3100 registerMockedHttpURLLoad("large-div.html");
3101 3101
3102 int viewWidth = 500; 3102 int viewWidth = 500;
3103 int viewHeight = 500; 3103 int viewHeight = 500;
3104 3104
3105 std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = 3105 std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient =
3106 wrapUnique(new FakeCompositingWebViewClient()); 3106 makeUnique<FakeCompositingWebViewClient>();
3107 FrameTestHelpers::WebViewHelper webViewHelper; 3107 FrameTestHelpers::WebViewHelper webViewHelper;
3108 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), 3108 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(),
3109 nullptr, &configureCompositingWebView); 3109 nullptr, &configureCompositingWebView);
3110 3110
3111 webViewHelper.resize(WebSize(viewWidth, viewHeight)); 3111 webViewHelper.resize(WebSize(viewWidth, viewHeight));
3112 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 3112 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
3113 m_baseURL + "large-div.html"); 3113 m_baseURL + "large-div.html");
3114 3114
3115 FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView(); 3115 FrameView* view = webViewHelper.webView()->mainFrameImpl()->frameView();
3116 EXPECT_TRUE( 3116 EXPECT_TRUE(
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after
4265 4265
4266 Vector<std::unique_ptr<Notification>> createNotifications; 4266 Vector<std::unique_ptr<Notification>> createNotifications;
4267 Vector<std::unique_ptr<Notification>> releaseNotifications; 4267 Vector<std::unique_ptr<Notification>> releaseNotifications;
4268 4268
4269 private: 4269 private:
4270 void didCreateScriptContext(WebLocalFrame* frame, 4270 void didCreateScriptContext(WebLocalFrame* frame,
4271 v8::Local<v8::Context> context, 4271 v8::Local<v8::Context> context,
4272 int extensionGroup, 4272 int extensionGroup,
4273 int worldId) override { 4273 int worldId) override {
4274 createNotifications.append( 4274 createNotifications.append(
4275 wrapUnique(new Notification(frame, context, worldId))); 4275 makeUnique<Notification>(frame, context, worldId));
4276 } 4276 }
4277 4277
4278 void willReleaseScriptContext(WebLocalFrame* frame, 4278 void willReleaseScriptContext(WebLocalFrame* frame,
4279 v8::Local<v8::Context> context, 4279 v8::Local<v8::Context> context,
4280 int worldId) override { 4280 int worldId) override {
4281 releaseNotifications.append( 4281 releaseNotifications.append(
4282 wrapUnique(new Notification(frame, context, worldId))); 4282 makeUnique<Notification>(frame, context, worldId));
4283 } 4283 }
4284 }; 4284 };
4285 4285
4286 TEST_P(ParameterizedWebFrameTest, ContextNotificationsLoadUnload) { 4286 TEST_P(ParameterizedWebFrameTest, ContextNotificationsLoadUnload) {
4287 v8::HandleScope handleScope(v8::Isolate::GetCurrent()); 4287 v8::HandleScope handleScope(v8::Isolate::GetCurrent());
4288 4288
4289 registerMockedHttpURLLoad("context_notifications_test.html"); 4289 registerMockedHttpURLLoad("context_notifications_test.html");
4290 registerMockedHttpURLLoad("context_notifications_test_frame.html"); 4290 registerMockedHttpURLLoad("context_notifications_test_frame.html");
4291 4291
4292 // Load a frame with an iframe, make sure we get the right create 4292 // Load a frame with an iframe, make sure we get the right create
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
5452 EXPECT_EQ(endRect, initialEndRect); 5452 EXPECT_EQ(endRect, initialEndRect);
5453 } 5453 }
5454 #endif 5454 #endif
5455 5455
5456 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView { 5456 class CompositedSelectionBoundsTestLayerTreeView : public WebLayerTreeView {
5457 public: 5457 public:
5458 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) {} 5458 CompositedSelectionBoundsTestLayerTreeView() : m_selectionCleared(false) {}
5459 ~CompositedSelectionBoundsTestLayerTreeView() override {} 5459 ~CompositedSelectionBoundsTestLayerTreeView() override {}
5460 5460
5461 void registerSelection(const WebSelection& selection) override { 5461 void registerSelection(const WebSelection& selection) override {
5462 m_selection = wrapUnique(new WebSelection(selection)); 5462 m_selection = makeUnique<WebSelection>(selection);
5463 } 5463 }
5464 5464
5465 void clearSelection() override { 5465 void clearSelection() override {
5466 m_selectionCleared = true; 5466 m_selectionCleared = true;
5467 m_selection.reset(); 5467 m_selection.reset();
5468 } 5468 }
5469 5469
5470 bool getAndResetSelectionCleared() { 5470 bool getAndResetSelectionCleared() {
5471 bool selectionCleared = m_selectionCleared; 5471 bool selectionCleared = m_selectionCleared;
5472 m_selectionCleared = false; 5472 m_selectionCleared = false;
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
7351 FrameTestHelpers::loadFrame(iframe, url2); 7351 FrameTestHelpers::loadFrame(iframe, url2);
7352 EXPECT_EQ(iframe, client.frame()); 7352 EXPECT_EQ(iframe, client.frame());
7353 EXPECT_EQ(url2, iframe->document().url().string().utf8()); 7353 EXPECT_EQ(url2, iframe->document().url().string().utf8());
7354 EXPECT_FALSE(client.replacesCurrentHistoryItem()); 7354 EXPECT_FALSE(client.replacesCurrentHistoryItem());
7355 } 7355 }
7356 7356
7357 // Test verifies that layout will change a layer's scrollable attibutes 7357 // Test verifies that layout will change a layer's scrollable attibutes
7358 TEST_F(WebFrameTest, overflowHiddenRewrite) { 7358 TEST_F(WebFrameTest, overflowHiddenRewrite) {
7359 registerMockedHttpURLLoad("non-scrollable.html"); 7359 registerMockedHttpURLLoad("non-scrollable.html");
7360 std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = 7360 std::unique_ptr<FakeCompositingWebViewClient> fakeCompositingWebViewClient =
7361 wrapUnique(new FakeCompositingWebViewClient()); 7361 makeUnique<FakeCompositingWebViewClient>();
7362 FrameTestHelpers::WebViewHelper webViewHelper; 7362 FrameTestHelpers::WebViewHelper webViewHelper;
7363 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(), 7363 webViewHelper.initialize(true, nullptr, fakeCompositingWebViewClient.get(),
7364 nullptr, &configureCompositingWebView); 7364 nullptr, &configureCompositingWebView);
7365 7365
7366 webViewHelper.resize(WebSize(100, 100)); 7366 webViewHelper.resize(WebSize(100, 100));
7367 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), 7367 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(),
7368 m_baseURL + "non-scrollable.html"); 7368 m_baseURL + "non-scrollable.html");
7369 7369
7370 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor(); 7370 PaintLayerCompositor* compositor = webViewHelper.webView()->compositor();
7371 ASSERT_TRUE(compositor->scrollLayer()); 7371 ASSERT_TRUE(compositor->scrollLayer());
(...skipping 2876 matching lines...) Expand 10 before | Expand all | Expand 10 after
10248 TestResourcePriorityWebFrameClient() {} 10248 TestResourcePriorityWebFrameClient() {}
10249 10249
10250 void willSendRequest(WebLocalFrame*, WebURLRequest& request) override { 10250 void willSendRequest(WebLocalFrame*, WebURLRequest& request) override {
10251 ExpectedRequest* expectedRequest = m_expectedRequests.get(request.url()); 10251 ExpectedRequest* expectedRequest = m_expectedRequests.get(request.url());
10252 DCHECK(expectedRequest); 10252 DCHECK(expectedRequest);
10253 EXPECT_EQ(expectedRequest->priority, request.getPriority()); 10253 EXPECT_EQ(expectedRequest->priority, request.getPriority());
10254 expectedRequest->seen = true; 10254 expectedRequest->seen = true;
10255 } 10255 }
10256 10256
10257 void addExpectedRequest(const KURL& url, WebURLRequest::Priority priority) { 10257 void addExpectedRequest(const KURL& url, WebURLRequest::Priority priority) {
10258 m_expectedRequests.add(url, wrapUnique(new ExpectedRequest(url, priority))); 10258 m_expectedRequests.add(url, makeUnique<ExpectedRequest>(url, priority));
10259 } 10259 }
10260 10260
10261 void verifyAllRequests() { 10261 void verifyAllRequests() {
10262 for (const auto& request : m_expectedRequests) 10262 for (const auto& request : m_expectedRequests)
10263 EXPECT_TRUE(request.value->seen); 10263 EXPECT_TRUE(request.value->seen);
10264 } 10264 }
10265 10265
10266 private: 10266 private:
10267 HashMap<KURL, std::unique_ptr<ExpectedRequest>> m_expectedRequests; 10267 HashMap<KURL, std::unique_ptr<ExpectedRequest>> m_expectedRequests;
10268 }; 10268 };
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
10552 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame(); 10552 Frame* mainFrame = webViewHelper.webView()->mainFrameImpl()->frame();
10553 HashSet<AtomicString> names; 10553 HashSet<AtomicString> names;
10554 for (Frame* frame = mainFrame->tree().firstChild(); frame; 10554 for (Frame* frame = mainFrame->tree().firstChild(); frame;
10555 frame = frame->tree().traverseNext()) { 10555 frame = frame->tree().traverseNext()) {
10556 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry); 10556 EXPECT_TRUE(names.add(frame->tree().uniqueName()).isNewEntry);
10557 } 10557 }
10558 EXPECT_EQ(10u, names.size()); 10558 EXPECT_EQ(10u, names.size());
10559 } 10559 }
10560 10560
10561 } // namespace blink 10561 } // 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