1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_WEB_VIEW_TEST_FRAME_TREE_DELEGATE_H_
6 #define COMPONENTS_WEB_VIEW_TEST_FRAME_TREE_DELEGATE_H_
8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "components/web_view/frame_tree_delegate.h"
17 class ApplicationImpl
;
22 class TestFrameTreeDelegate
: public FrameTreeDelegate
{
24 explicit TestFrameTreeDelegate(mojo::ApplicationImpl
* app
);
25 ~TestFrameTreeDelegate() override
;
27 mojo::ApplicationImpl
* app() { return app_
; }
29 void WaitForCreateFrame();
30 void WaitForDestroyFrame(Frame
* frame
);
32 // TestFrameTreeDelegate:
33 bool CanPostMessageEventToFrame(const Frame
* source
,
35 HTMLMessageEvent
* event
) override
;
36 void LoadingStateChanged(bool loading
) override
;
37 void ProgressChanged(double progress
) override
;
38 void TitleChanged(const mojo::String
& title
) override
;
39 void NavigateTopLevel(Frame
* source
, mojo::URLRequestPtr request
) override
;
40 void CanNavigateFrame(Frame
* target
,
41 mojo::URLRequestPtr request
,
42 const CanNavigateFrameCallback
& callback
) override
;
43 void DidStartNavigation(Frame
* frame
) override
;
44 void DidCreateFrame(Frame
* frame
) override
;
45 void DidDestroyFrame(Frame
* frame
) override
;
48 bool is_waiting() const { return run_loop_
.get(); }
50 mojo::ApplicationImpl
* app_
;
51 bool waiting_for_create_frame_
;
52 Frame
* waiting_for_destroy_frame_
;
53 scoped_ptr
<base::RunLoop
> run_loop_
;
55 DISALLOW_COPY_AND_ASSIGN(TestFrameTreeDelegate
);
58 } // namespace web_view
60 #endif // COMPONENTS_WEB_VIEW_TEST_FRAME_TREE_DELEGATE_H_