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

Side by Side Diff: android_webview/browser/test/fake_window.cc

Issue 1002013003: Unit Test for WebView animating in and out of screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "android_webview/browser/test/fake_window.h" 5 #include "android_webview/browser/test/fake_window.h"
6 6
7 #include "android_webview/browser/browser_view_renderer.h" 7 #include "android_webview/browser/browser_view_renderer.h"
8 #include "android_webview/public/browser/draw_gl.h" 8 #include "android_webview/public/browser/draw_gl.h"
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 base::MessageLoopProxy::current()->PostTask( 112 base::MessageLoopProxy::current()->PostTask(
113 FROM_HERE, 113 FROM_HERE,
114 base::Bind(&FakeWindow::OnDrawHardware, weak_ptr_factory_.GetWeakPtr())); 114 base::Bind(&FakeWindow::OnDrawHardware, weak_ptr_factory_.GetWeakPtr()));
115 } 115 }
116 116
117 void FakeWindow::OnDrawHardware() { 117 void FakeWindow::OnDrawHardware() {
118 CheckCurrentlyOnUIThread(); 118 CheckCurrentlyOnUIThread();
119 DCHECK(on_draw_hardware_pending_); 119 DCHECK(on_draw_hardware_pending_);
120 on_draw_hardware_pending_ = false; 120 on_draw_hardware_pending_ = false;
121 121
122 view_->PrepareToDraw(gfx::Vector2d(), location_);
122 hooks_->WillOnDraw(); 123 hooks_->WillOnDraw();
123 view_->PrepareToDraw(gfx::Vector2d(), location_);
124 bool success = view_->OnDrawHardware(); 124 bool success = view_->OnDrawHardware();
125 hooks_->DidOnDraw(success); 125 hooks_->DidOnDraw(success);
126 if (success) { 126 if (success) {
127 CreateRenderThreadIfNeeded(); 127 CreateRenderThreadIfNeeded();
128 128
129 base::WaitableEvent completion(true, false); 129 base::WaitableEvent completion(true, false);
130 render_thread_loop_->PostTask( 130 render_thread_loop_->PostTask(
131 FROM_HERE, base::Bind(&FakeWindow::DrawFunctorOnRT, 131 FROM_HERE, base::Bind(&FakeWindow::DrawFunctorOnRT,
132 base::Unretained(this), &completion)); 132 base::Unretained(this), &completion));
133 completion.Wait(); 133 completion.Wait();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 draw_info.transform[8] = 0.0; 173 draw_info.transform[8] = 0.0;
174 draw_info.transform[9] = 0.0; 174 draw_info.transform[9] = 0.0;
175 draw_info.transform[10] = 1.0; 175 draw_info.transform[10] = 1.0;
176 draw_info.transform[11] = 0.0; 176 draw_info.transform[11] = 0.0;
177 177
178 draw_info.transform[12] = 0.0; 178 draw_info.transform[12] = 0.0;
179 draw_info.transform[13] = 0.0; 179 draw_info.transform[13] = 0.0;
180 draw_info.transform[14] = 0.0; 180 draw_info.transform[14] = 0.0;
181 draw_info.transform[15] = 1.0; 181 draw_info.transform[15] = 1.0;
182 182
183 hooks_->WillDrawOnRT(functor_); 183 if (!hooks_->WillDrawOnRT(functor_))
184 return;
185
184 { 186 {
185 ScopedMakeCurrent make_current(this); 187 ScopedMakeCurrent make_current(this);
186 functor_->DrawGL(&draw_info); 188 functor_->DrawGL(&draw_info);
187 } 189 }
188 hooks_->DidDrawOnRT(functor_); 190 hooks_->DidDrawOnRT(functor_);
189 } 191 }
190 192
191 void FakeWindow::CheckCurrentlyOnUIThread() { 193 void FakeWindow::CheckCurrentlyOnUIThread() {
192 DCHECK(ui_checker_.CalledOnValidSequencedThread()); 194 DCHECK(ui_checker_.CalledOnValidSequencedThread());
193 } 195 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 surface_ = nullptr; 233 surface_ = nullptr;
232 } 234 }
233 sync->Signal(); 235 sync->Signal();
234 } 236 }
235 237
236 void FakeWindow::CheckCurrentlyOnRT() { 238 void FakeWindow::CheckCurrentlyOnRT() {
237 DCHECK(rt_checker_.CalledOnValidSequencedThread()); 239 DCHECK(rt_checker_.CalledOnValidSequencedThread());
238 } 240 }
239 241
240 } // namespace android_webview 242 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698