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

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

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: comments 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 #ifndef ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_
6 #define ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ 6 #define ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "android_webview/public/browser/draw_gl.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/sequence_checker.h" 12 #include "base/sequence_checker.h"
12 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
13 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
14 #include "ui/gl/gl_context.h" 15 #include "ui/gl/gl_context.h"
15 #include "ui/gl/gl_surface.h" 16 #include "ui/gl/gl_surface.h"
16 17
17 namespace base { 18 namespace base {
18 class Thread; 19 class Thread;
19 class WaitableEvent; 20 class WaitableEvent;
20 } 21 }
21 22
22 namespace android_webview { 23 namespace android_webview {
23 24
24 class BrowserViewRenderer; 25 class BrowserViewRenderer;
25 class SharedRendererState; 26 class SharedRendererState;
26 27
27 class WindowHooks { 28 class WindowHooks {
28 public: 29 public:
29 virtual ~WindowHooks() {} 30 virtual ~WindowHooks() {}
30 31
31 virtual void WillOnDraw() = 0; 32 virtual void WillOnDraw() = 0;
32 virtual void DidOnDraw(bool success) = 0; 33 virtual void DidOnDraw(bool success) = 0;
33 34
34 virtual void WillSyncOnRT(SharedRendererState* functor) = 0; 35 virtual void WillSyncOnRT(SharedRendererState* functor) = 0;
35 virtual void DidSyncOnRT(SharedRendererState* functor) = 0; 36 virtual void DidSyncOnRT(SharedRendererState* functor) = 0;
36 virtual void WillProcessOnRT(SharedRendererState* functor) = 0; 37 virtual void WillProcessOnRT(SharedRendererState* functor) = 0;
37 virtual void DidProcessOnRT(SharedRendererState* functor) = 0; 38 virtual void DidProcessOnRT(SharedRendererState* functor) = 0;
38 virtual void WillDrawOnRT(SharedRendererState* functor) = 0; 39 virtual bool WillDrawOnRT(SharedRendererState* functor,
40 AwDrawGLInfo* draw_info) = 0;
39 virtual void DidDrawOnRT(SharedRendererState* functor) = 0; 41 virtual void DidDrawOnRT(SharedRendererState* functor) = 0;
40 }; 42 };
41 43
42 class FakeWindow { 44 class FakeWindow {
43 public: 45 public:
44 FakeWindow(BrowserViewRenderer* view, 46 FakeWindow(BrowserViewRenderer* view,
45 WindowHooks* hooks, 47 WindowHooks* hooks,
46 gfx::Rect location); 48 gfx::Rect location);
47 ~FakeWindow(); 49 ~FakeWindow();
48 50
49 void Detach(); 51 void Detach();
50 52
51 // BrowserViewRendererClient methods. 53 // BrowserViewRendererClient methods.
52 void RequestDrawGL(bool wait_for_completion); 54 void RequestDrawGL(bool wait_for_completion);
53 void PostInvalidate(); 55 void PostInvalidate();
56 const gfx::Size& surface_size() { return surface_size_; }
54 57
55 private: 58 private:
56 class ScopedMakeCurrent; 59 class ScopedMakeCurrent;
57 60
58 void OnDrawHardware(); 61 void OnDrawHardware();
59 void CheckCurrentlyOnUIThread(); 62 void CheckCurrentlyOnUIThread();
60 void CreateRenderThreadIfNeeded(); 63 void CreateRenderThreadIfNeeded();
61 64
62 void InitializeOnRT(base::WaitableEvent* sync); 65 void InitializeOnRT(base::WaitableEvent* sync);
63 void DestroyOnRT(base::WaitableEvent* sync); 66 void DestroyOnRT(base::WaitableEvent* sync);
(...skipping 21 matching lines...) Expand all
85 bool context_current_; 88 bool context_current_;
86 89
87 base::WeakPtrFactory<FakeWindow> weak_ptr_factory_; 90 base::WeakPtrFactory<FakeWindow> weak_ptr_factory_;
88 91
89 DISALLOW_COPY_AND_ASSIGN(FakeWindow); 92 DISALLOW_COPY_AND_ASSIGN(FakeWindow);
90 }; 93 };
91 94
92 } // namespace android_webview 95 } // namespace android_webview
93 96
94 #endif // ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_ 97 #endif // ANDROID_WEBVIEW_BROWSER_TEST_FAKE_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698