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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2425923003: Replaced is_null() with is_valid in SurfaceId and related classes. (Closed)
Patch Set: Removed added printf statements; LocalFrameId::is_valid() no longer checks if nonce is 0. Created 4 years, 2 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 367 }
368 368
369 cc::SurfaceId surface_id() const { 369 cc::SurfaceId surface_id() const {
370 return GetDelegatedFrameHost()->SurfaceIdForTesting(); 370 return GetDelegatedFrameHost()->SurfaceIdForTesting();
371 } 371 }
372 372
373 const cc::LocalFrameId& GetLocalFrameId() const { 373 const cc::LocalFrameId& GetLocalFrameId() const {
374 return GetDelegatedFrameHost()->LocalFrameIdForTesting(); 374 return GetDelegatedFrameHost()->LocalFrameIdForTesting();
375 } 375 }
376 376
377 bool HasFrameData() const { return !GetLocalFrameId().is_null(); } 377 bool HasFrameData() const { return GetLocalFrameId().is_valid(); }
378 378
379 bool released_front_lock_active() const { 379 bool released_front_lock_active() const {
380 return GetDelegatedFrameHost()->ReleasedFrontLockActiveForTesting(); 380 return GetDelegatedFrameHost()->ReleasedFrontLockActiveForTesting();
381 } 381 }
382 382
383 void ReturnResources(const cc::ReturnedResourceArray& resources) { 383 void ReturnResources(const cc::ReturnedResourceArray& resources) {
384 GetDelegatedFrameHost()->ReturnResources(resources); 384 GetDelegatedFrameHost()->ReturnResources(resources);
385 } 385 }
386 386
387 void ResetCompositor() { GetDelegatedFrameHost()->ResetCompositor(); } 387 void ResetCompositor() { GetDelegatedFrameHost()->ResetCompositor(); }
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1904 gfx::Rect()); 1904 gfx::Rect());
1905 view_->SetSize(view_size); 1905 view_->SetSize(view_size);
1906 view_->Show(); 1906 view_->Show();
1907 1907
1908 view_->OnSwapCompositorFrame(0, 1908 view_->OnSwapCompositorFrame(0,
1909 MakeDelegatedFrame(1.f, view_size, view_rect)); 1909 MakeDelegatedFrame(1.f, view_size, view_rect));
1910 std::unique_ptr<ui::LayerTreeOwner> cloned_owner( 1910 std::unique_ptr<ui::LayerTreeOwner> cloned_owner(
1911 wm::RecreateLayers(view_->GetNativeView(), nullptr)); 1911 wm::RecreateLayers(view_->GetNativeView(), nullptr));
1912 1912
1913 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); 1913 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
1914 if (!id.is_null()) { 1914 if (id.is_valid()) {
1915 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1915 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1916 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1916 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1917 cc::Surface* surface = manager->GetSurfaceForId(id); 1917 cc::Surface* surface = manager->GetSurfaceForId(id);
1918 EXPECT_TRUE(surface); 1918 EXPECT_TRUE(surface);
1919 // Should be a SurfaceSequence for both the original and new layers. 1919 // Should be a SurfaceSequence for both the original and new layers.
1920 EXPECT_EQ(2u, surface->GetDestructionDependencyCount()); 1920 EXPECT_EQ(2u, surface->GetDestructionDependencyCount());
1921 } 1921 }
1922 } 1922 }
1923 1923
1924 // If the view size is larger than the compositor frame then extra layers 1924 // If the view size is larger than the compositor frame then extra layers
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2029 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, 2029 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID,
2030 sink_->GetMessageAt(0)->type()); 2030 sink_->GetMessageAt(0)->type());
2031 sink_->ClearMessages(); 2031 sink_->ClearMessages();
2032 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); 2032 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString());
2033 2033
2034 // Receive a frame of the correct size, should not be skipped and, and should 2034 // Receive a frame of the correct size, should not be skipped and, and should
2035 // produce a Resize message after the commit. 2035 // produce a Resize message after the commit.
2036 view_->OnSwapCompositorFrame( 2036 view_->OnSwapCompositorFrame(
2037 0, MakeDelegatedFrame(1.f, size2, gfx::Rect(size2))); 2037 0, MakeDelegatedFrame(1.f, size2, gfx::Rect(size2)));
2038 cc::SurfaceId surface_id = view_->surface_id(); 2038 cc::SurfaceId surface_id = view_->surface_id();
2039 if (surface_id.is_null()) { 2039 if (!surface_id.is_valid()) {
2040 // No frame ack yet. 2040 // No frame ack yet.
2041 EXPECT_EQ(0u, sink_->message_count()); 2041 EXPECT_EQ(0u, sink_->message_count());
2042 } else { 2042 } else {
2043 // Frame isn't desired size, so early ack. 2043 // Frame isn't desired size, so early ack.
2044 EXPECT_EQ(1u, sink_->message_count()); 2044 EXPECT_EQ(1u, sink_->message_count());
2045 } 2045 }
2046 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); 2046 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString());
2047 2047
2048 // Wait for commit, then we should unlock the compositor and send a Resize 2048 // Wait for commit, then we should unlock the compositor and send a Resize
2049 // message (and a frame ack) 2049 // message (and a frame ack)
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 // Create a fake tick clock and transfer ownership to the frame host. 2623 // Create a fake tick clock and transfer ownership to the frame host.
2624 tick_clock_ = new base::SimpleTestTickClock(); 2624 tick_clock_ = new base::SimpleTestTickClock();
2625 view_->GetDelegatedFrameHost()->tick_clock_ = base::WrapUnique(tick_clock_); 2625 view_->GetDelegatedFrameHost()->tick_clock_ = base::WrapUnique(tick_clock_);
2626 } 2626 }
2627 2627
2628 void OnSwapCompositorFrame() { 2628 void OnSwapCompositorFrame() {
2629 view_->OnSwapCompositorFrame( 2629 view_->OnSwapCompositorFrame(
2630 1, MakeDelegatedFrame(1.f, view_rect_.size(), view_rect_)); 2630 1, MakeDelegatedFrame(1.f, view_rect_.size(), view_rect_));
2631 cc::SurfaceId surface_id = 2631 cc::SurfaceId surface_id =
2632 view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); 2632 view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
2633 if (!surface_id.is_null()) 2633 if (surface_id.is_valid())
2634 view_->GetDelegatedFrameHost()->WillDrawSurface( 2634 view_->GetDelegatedFrameHost()->WillDrawSurface(
2635 surface_id.local_frame_id(), view_rect_); 2635 surface_id.local_frame_id(), view_rect_);
2636 ASSERT_TRUE(view_->last_copy_request_); 2636 ASSERT_TRUE(view_->last_copy_request_);
2637 } 2637 }
2638 2638
2639 void ReleaseSwappedFrame() { 2639 void ReleaseSwappedFrame() {
2640 std::unique_ptr<cc::CopyOutputRequest> request = 2640 std::unique_ptr<cc::CopyOutputRequest> request =
2641 std::move(view_->last_copy_request_); 2641 std::move(view_->last_copy_request_);
2642 request->SendTextureResult(view_rect_.size(), request->texture_mailbox(), 2642 request->SendTextureResult(view_rect_.size(), request->texture_mailbox(),
2643 std::unique_ptr<cc::SingleReleaseCallback>()); 2643 std::unique_ptr<cc::SingleReleaseCallback>());
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after
4682 4682
4683 // Retrieve the selected text from clipboard and verify it is as expected. 4683 // Retrieve the selected text from clipboard and verify it is as expected.
4684 base::string16 result_text; 4684 base::string16 result_text;
4685 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4685 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4686 EXPECT_EQ(expected_text, result_text); 4686 EXPECT_EQ(expected_text, result_text);
4687 } 4687 }
4688 } 4688 }
4689 #endif 4689 #endif
4690 4690
4691 } // namespace content 4691 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698