OLD | NEW |
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 "components/html_viewer/ax_provider_impl.h" | 5 #include "components/html_viewer/ax_provider_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "components/html_viewer/blink_platform_impl.h" | 9 #include "components/html_viewer/blink_platform_impl.h" |
| 10 #include "components/scheduler/renderer/renderer_scheduler.h" |
10 #include "gin/v8_initializer.h" | 11 #include "gin/v8_initializer.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "third_party/WebKit/public/platform/WebData.h" | 13 #include "third_party/WebKit/public/platform/WebData.h" |
13 #include "third_party/WebKit/public/platform/WebURL.h" | 14 #include "third_party/WebKit/public/platform/WebURL.h" |
14 #include "third_party/WebKit/public/web/WebFrameClient.h" | 15 #include "third_party/WebKit/public/web/WebFrameClient.h" |
15 #include "third_party/WebKit/public/web/WebKit.h" | 16 #include "third_party/WebKit/public/web/WebKit.h" |
16 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
17 #include "third_party/WebKit/public/web/WebView.h" | 18 #include "third_party/WebKit/public/web/WebView.h" |
18 #include "third_party/WebKit/public/web/WebViewClient.h" | 19 #include "third_party/WebKit/public/web/WebViewClient.h" |
19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
(...skipping 18 matching lines...) Expand all Loading... |
38 }; | 39 }; |
39 | 40 |
40 class TestWebViewClient : public WebViewClient { | 41 class TestWebViewClient : public WebViewClient { |
41 public: | 42 public: |
42 bool allowsBrokenNullLayerTreeView() const override { return true; } | 43 bool allowsBrokenNullLayerTreeView() const override { return true; } |
43 virtual ~TestWebViewClient() {} | 44 virtual ~TestWebViewClient() {} |
44 }; | 45 }; |
45 | 46 |
46 class AxProviderImplTest : public testing::Test { | 47 class AxProviderImplTest : public testing::Test { |
47 public: | 48 public: |
48 AxProviderImplTest() { | 49 AxProviderImplTest() |
| 50 : renderer_scheduler_(scheduler::RendererScheduler::Create()) { |
49 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 51 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
50 gin::V8Initializer::LoadV8Snapshot(); | 52 gin::V8Initializer::LoadV8Snapshot(); |
51 #endif | 53 #endif |
52 blink::initialize(new html_viewer::BlinkPlatformImpl(nullptr)); | 54 blink::initialize( |
| 55 new html_viewer::BlinkPlatformImpl(nullptr, renderer_scheduler_.get())); |
53 } | 56 } |
54 | 57 |
55 ~AxProviderImplTest() override { blink::shutdown(); } | 58 ~AxProviderImplTest() override { blink::shutdown(); } |
56 | 59 |
57 private: | 60 private: |
58 base::MessageLoopForUI message_loop; | 61 base::MessageLoopForUI message_loop; |
| 62 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_; |
59 }; | 63 }; |
60 | 64 |
61 struct NodeCatcher { | 65 struct NodeCatcher { |
62 void OnNodes(Array<AxNodePtr> nodes) { this->nodes = nodes.Pass(); } | 66 void OnNodes(Array<AxNodePtr> nodes) { this->nodes = nodes.Pass(); } |
63 Array<AxNodePtr> nodes; | 67 Array<AxNodePtr> nodes; |
64 }; | 68 }; |
65 | 69 |
66 AxNodePtr CreateNode(int id, | 70 AxNodePtr CreateNode(int id, |
67 int parent_id, | 71 int parent_id, |
68 int next_sibling_id, | 72 int next_sibling_id, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 "", | 173 "", |
170 "")); | 174 "")); |
171 } | 175 } |
172 } | 176 } |
173 | 177 |
174 // TODO(aa): Test bounds. | 178 // TODO(aa): Test bounds. |
175 // TODO(aa): Test sibling ordering of foo/bar/baz. | 179 // TODO(aa): Test sibling ordering of foo/bar/baz. |
176 | 180 |
177 view->close(); | 181 view->close(); |
178 } | 182 } |
OLD | NEW |