| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/test/test_timeouts.h" | 9 #include "base/test/test_timeouts.h" |
| 10 #include "components/mus/public/cpp/tests/view_manager_test_base.h" | 10 #include "components/mus/public/cpp/tests/view_manager_test_base.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 mojo::URLRequestPtr request) override {} | 55 mojo::URLRequestPtr request) override {} |
| 56 void DidNavigateLocally(uint32_t frame_id, const mojo::String& url) override { | 56 void DidNavigateLocally(uint32_t frame_id, const mojo::String& url) override { |
| 57 } | 57 } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 DISALLOW_COPY_AND_ASSIGN(TestFrameTreeServer); | 60 DISALLOW_COPY_AND_ASSIGN(TestFrameTreeServer); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 } // namespace | 63 } // namespace |
| 64 | 64 |
| 65 using AXProviderTest = ViewManagerTestBase; | 65 using AXProviderTest = mus::ViewManagerTestBase; |
| 66 | 66 |
| 67 TEST_F(AXProviderTest, HelloWorld) { | 67 TEST_F(AXProviderTest, HelloWorld) { |
| 68 // Start a test server for net/data/test.html access. | 68 // Start a test server for net/data/test.html access. |
| 69 net::SpawnedTestServer server( | 69 net::SpawnedTestServer server( |
| 70 net::SpawnedTestServer::TYPE_HTTP, net::SpawnedTestServer::kLocalhost, | 70 net::SpawnedTestServer::TYPE_HTTP, net::SpawnedTestServer::kLocalhost, |
| 71 base::FilePath(FILE_PATH_LITERAL("net/data"))); | 71 base::FilePath(FILE_PATH_LITERAL("net/data"))); |
| 72 ASSERT_TRUE(server.Start()); | 72 ASSERT_TRUE(server.Start()); |
| 73 | 73 |
| 74 // Connect to the URL through the mojo:html_viewer content handler. | 74 // Connect to the URL through the mojo:html_viewer content handler. |
| 75 const uint16_t assigned_port = server.host_port_pair().port(); | 75 const uint16_t assigned_port = server.host_port_pair().port(); |
| 76 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 76 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 77 request->url = mojo::String::From( | 77 request->url = mojo::String::From( |
| 78 base::StringPrintf("http://127.0.0.1:%u/files/test.html", assigned_port)); | 78 base::StringPrintf("http://127.0.0.1:%u/files/test.html", assigned_port)); |
| 79 scoped_ptr<ApplicationConnection> connection = | 79 scoped_ptr<ApplicationConnection> connection = |
| 80 application_impl()->ConnectToApplication(request.Pass()); | 80 application_impl()->ConnectToApplication(request.Pass()); |
| 81 | 81 |
| 82 // Embed the html_viewer in a View. | 82 // Embed the html_viewer in a View. |
| 83 ViewTreeClientPtr tree_client; | 83 ViewTreeClientPtr tree_client; |
| 84 connection->ConnectToService(&tree_client); | 84 connection->ConnectToService(&tree_client); |
| 85 View* embed_view = window_manager()->CreateView(); | 85 mus::View* embed_view = window_manager()->CreateView(); |
| 86 embed_view->Embed(tree_client.Pass()); | 86 embed_view->Embed(tree_client.Pass()); |
| 87 | 87 |
| 88 TestFrameTreeServer frame_tree_server; | 88 TestFrameTreeServer frame_tree_server; |
| 89 web_view::FrameTreeServerPtr frame_tree_server_ptr; | 89 web_view::FrameTreeServerPtr frame_tree_server_ptr; |
| 90 mojo::Binding<web_view::FrameTreeServer> frame_tree_server_binding( | 90 mojo::Binding<web_view::FrameTreeServer> frame_tree_server_binding( |
| 91 &frame_tree_server); | 91 &frame_tree_server); |
| 92 frame_tree_server_binding.Bind(GetProxy(&frame_tree_server_ptr).Pass()); | 92 frame_tree_server_binding.Bind(GetProxy(&frame_tree_server_ptr).Pass()); |
| 93 | 93 |
| 94 mojo::Array<web_view::FrameDataPtr> array(1u); | 94 mojo::Array<web_view::FrameDataPtr> array(1u); |
| 95 array[0] = web_view::FrameData::New().Pass(); | 95 array[0] = web_view::FrameData::New().Pass(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 111 EXPECT_TRUE(QuitRunLoop()); | 111 EXPECT_TRUE(QuitRunLoop()); |
| 112 }); | 112 }); |
| 113 ASSERT_TRUE(DoRunLoopWithTimeout()); | 113 ASSERT_TRUE(DoRunLoopWithTimeout()); |
| 114 | 114 |
| 115 EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); | 115 EXPECT_TRUE(AxTreeContainsText(ax_tree, "Hello ")); |
| 116 EXPECT_TRUE(AxTreeContainsText(ax_tree, "World!")); | 116 EXPECT_TRUE(AxTreeContainsText(ax_tree, "World!")); |
| 117 EXPECT_FALSE(AxTreeContainsText(ax_tree, "foo")); | 117 EXPECT_FALSE(AxTreeContainsText(ax_tree, "foo")); |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace mojo | 120 } // namespace mojo |
| OLD | NEW |