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

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: Rebase 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 // 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 cc::SurfaceId surface_id() const { 371 cc::SurfaceId surface_id() const {
372 return GetDelegatedFrameHost()->SurfaceIdForTesting(); 372 return GetDelegatedFrameHost()->SurfaceIdForTesting();
373 } 373 }
374 374
375 const cc::LocalFrameId& GetLocalFrameId() const { 375 const cc::LocalFrameId& GetLocalFrameId() const {
376 return GetDelegatedFrameHost()->LocalFrameIdForTesting(); 376 return GetDelegatedFrameHost()->LocalFrameIdForTesting();
377 } 377 }
378 378
379 bool HasFrameData() const { return !GetLocalFrameId().is_null(); } 379 bool HasFrameData() const { return GetLocalFrameId().is_valid(); }
380 380
381 bool released_front_lock_active() const { 381 bool released_front_lock_active() const {
382 return GetDelegatedFrameHost()->ReleasedFrontLockActiveForTesting(); 382 return GetDelegatedFrameHost()->ReleasedFrontLockActiveForTesting();
383 } 383 }
384 384
385 void ReturnResources(const cc::ReturnedResourceArray& resources) { 385 void ReturnResources(const cc::ReturnedResourceArray& resources) {
386 GetDelegatedFrameHost()->ReturnResources(resources); 386 GetDelegatedFrameHost()->ReturnResources(resources);
387 } 387 }
388 388
389 void ResetCompositor() { GetDelegatedFrameHost()->ResetCompositor(); } 389 void ResetCompositor() { GetDelegatedFrameHost()->ResetCompositor(); }
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 view_->GetNativeView(), root, gfx::Rect()); 1911 view_->GetNativeView(), root, gfx::Rect());
1912 view_->SetSize(view_size); 1912 view_->SetSize(view_size);
1913 view_->Show(); 1913 view_->Show();
1914 1914
1915 view_->OnSwapCompositorFrame(0, 1915 view_->OnSwapCompositorFrame(0,
1916 MakeDelegatedFrame(1.f, view_size, view_rect)); 1916 MakeDelegatedFrame(1.f, view_size, view_rect));
1917 std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers( 1917 std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers(
1918 view_->GetNativeView(), false /* sync_bounds */)); 1918 view_->GetNativeView(), false /* sync_bounds */));
1919 1919
1920 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); 1920 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
1921 if (!id.is_null()) { 1921 if (id.is_valid()) {
1922 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1922 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1923 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1923 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1924 cc::Surface* surface = manager->GetSurfaceForId(id); 1924 cc::Surface* surface = manager->GetSurfaceForId(id);
1925 EXPECT_TRUE(surface); 1925 EXPECT_TRUE(surface);
1926 1926
1927 // An orphaned mirror should not be a destruction dependency. 1927 // An orphaned mirror should not be a destruction dependency.
1928 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); 1928 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
1929 1929
1930 // Both layers should be destruction dependencies. 1930 // Both layers should be destruction dependencies.
1931 root->layer()->Add(mirror->root()); 1931 root->layer()->Add(mirror->root());
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, 2042 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID,
2043 sink_->GetMessageAt(0)->type()); 2043 sink_->GetMessageAt(0)->type());
2044 sink_->ClearMessages(); 2044 sink_->ClearMessages();
2045 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); 2045 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString());
2046 2046
2047 // Receive a frame of the correct size, should not be skipped and, and should 2047 // Receive a frame of the correct size, should not be skipped and, and should
2048 // produce a Resize message after the commit. 2048 // produce a Resize message after the commit.
2049 view_->OnSwapCompositorFrame( 2049 view_->OnSwapCompositorFrame(
2050 0, MakeDelegatedFrame(1.f, size2, gfx::Rect(size2))); 2050 0, MakeDelegatedFrame(1.f, size2, gfx::Rect(size2)));
2051 cc::SurfaceId surface_id = view_->surface_id(); 2051 cc::SurfaceId surface_id = view_->surface_id();
2052 if (surface_id.is_null()) { 2052 if (!surface_id.is_valid()) {
2053 // No frame ack yet. 2053 // No frame ack yet.
2054 EXPECT_EQ(0u, sink_->message_count()); 2054 EXPECT_EQ(0u, sink_->message_count());
2055 } else { 2055 } else {
2056 // Frame isn't desired size, so early ack. 2056 // Frame isn't desired size, so early ack.
2057 EXPECT_EQ(1u, sink_->message_count()); 2057 EXPECT_EQ(1u, sink_->message_count());
2058 } 2058 }
2059 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); 2059 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString());
2060 2060
2061 // Wait for commit, then we should unlock the compositor and send a Resize 2061 // Wait for commit, then we should unlock the compositor and send a Resize
2062 // message (and a frame ack) 2062 // message (and a frame ack)
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
2636 // Create a fake tick clock and transfer ownership to the frame host. 2636 // Create a fake tick clock and transfer ownership to the frame host.
2637 tick_clock_ = new base::SimpleTestTickClock(); 2637 tick_clock_ = new base::SimpleTestTickClock();
2638 view_->GetDelegatedFrameHost()->tick_clock_ = base::WrapUnique(tick_clock_); 2638 view_->GetDelegatedFrameHost()->tick_clock_ = base::WrapUnique(tick_clock_);
2639 } 2639 }
2640 2640
2641 void OnSwapCompositorFrame() { 2641 void OnSwapCompositorFrame() {
2642 view_->OnSwapCompositorFrame( 2642 view_->OnSwapCompositorFrame(
2643 1, MakeDelegatedFrame(1.f, view_rect_.size(), view_rect_)); 2643 1, MakeDelegatedFrame(1.f, view_rect_.size(), view_rect_));
2644 cc::SurfaceId surface_id = 2644 cc::SurfaceId surface_id =
2645 view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); 2645 view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
2646 if (!surface_id.is_null()) 2646 if (surface_id.is_valid())
2647 view_->GetDelegatedFrameHost()->WillDrawSurface( 2647 view_->GetDelegatedFrameHost()->WillDrawSurface(
2648 surface_id.local_frame_id(), view_rect_); 2648 surface_id.local_frame_id(), view_rect_);
2649 ASSERT_TRUE(view_->last_copy_request_); 2649 ASSERT_TRUE(view_->last_copy_request_);
2650 } 2650 }
2651 2651
2652 void ReleaseSwappedFrame() { 2652 void ReleaseSwappedFrame() {
2653 std::unique_ptr<cc::CopyOutputRequest> request = 2653 std::unique_ptr<cc::CopyOutputRequest> request =
2654 std::move(view_->last_copy_request_); 2654 std::move(view_->last_copy_request_);
2655 request->SendTextureResult(view_rect_.size(), request->texture_mailbox(), 2655 request->SendTextureResult(view_rect_.size(), request->texture_mailbox(),
2656 std::unique_ptr<cc::SingleReleaseCallback>()); 2656 std::unique_ptr<cc::SingleReleaseCallback>());
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
4677 4677
4678 // Retrieve the selected text from clipboard and verify it is as expected. 4678 // Retrieve the selected text from clipboard and verify it is as expected.
4679 base::string16 result_text; 4679 base::string16 result_text;
4680 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4680 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4681 EXPECT_EQ(expected_text, result_text); 4681 EXPECT_EQ(expected_text, result_text);
4682 } 4682 }
4683 } 4683 }
4684 #endif 4684 #endif
4685 4685
4686 } // namespace content 4686 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698