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 "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" | 5 #include "mandoline/ui/desktop_ui/public/interfaces/launch_handler.mojom.h" |
6 #include "mojo/application/public/cpp/application_impl.h" | 6 #include "mojo/application/public/cpp/application_impl.h" |
7 #include "mojo/application/public/cpp/application_test_base.h" | 7 #include "mojo/application/public/cpp/application_test_base.h" |
8 | 8 |
9 namespace mandoline { | 9 namespace mandoline { |
10 | 10 |
11 class BrowserTest : public mojo::test::ApplicationTestBase { | 11 class BrowserTest : public mojo::test::ApplicationTestBase { |
12 public: | 12 public: |
13 BrowserTest() : ApplicationTestBase() {} | 13 BrowserTest() : ApplicationTestBase() {} |
14 ~BrowserTest() override {} | 14 ~BrowserTest() override {} |
15 | 15 |
16 // mojo::test::ApplicationTestBase: | 16 // mojo::test::ApplicationTestBase: |
17 void SetUp() override { | 17 void SetUp() override { |
18 mojo::test::ApplicationTestBase::SetUp(); | 18 mojo::test::ApplicationTestBase::SetUp(); |
19 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 19 application_impl()->ConnectToService("mojo:desktop_ui", &launch_handler_); |
20 request->url = mojo::String::From("mojo:desktop_ui"); | |
21 application_impl()->ConnectToService(request.Pass(), &launch_handler_); | |
22 ASSERT_TRUE(launch_handler_.is_bound()); | 20 ASSERT_TRUE(launch_handler_.is_bound()); |
23 } | 21 } |
24 | 22 |
25 protected: | 23 protected: |
26 LaunchHandlerPtr launch_handler_; | 24 LaunchHandlerPtr launch_handler_; |
27 | 25 |
28 private: | 26 private: |
29 MOJO_DISALLOW_COPY_AND_ASSIGN(BrowserTest); | 27 MOJO_DISALLOW_COPY_AND_ASSIGN(BrowserTest); |
30 }; | 28 }; |
31 | 29 |
32 // A simple sanity check for connecting to the LaunchHandler. | 30 // A simple sanity check for connecting to the LaunchHandler. |
33 TEST_F(BrowserTest, LaunchHandlerBasic) { | 31 TEST_F(BrowserTest, LaunchHandlerBasic) { |
34 ASSERT_TRUE(launch_handler_.is_bound()); | 32 ASSERT_TRUE(launch_handler_.is_bound()); |
35 launch_handler_->LaunchURL(mojo::String::From("data:text/html,foo")); | 33 launch_handler_->LaunchURL(mojo::String::From("data:text/html,foo")); |
36 EXPECT_TRUE(launch_handler_.is_bound()); | 34 EXPECT_TRUE(launch_handler_.is_bound()); |
37 } | 35 } |
38 | 36 |
39 } // namespace mandoline | 37 } // namespace mandoline |
OLD | NEW |