| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #include "chrome/browser/extensions/api/dial/dial_api.h" | 7 #include "chrome/browser/extensions/api/dial/dial_api.h" |
| 8 #include "chrome/browser/extensions/api/dial/dial_api_factory.h" | 8 #include "chrome/browser/extensions/api/dial/dial_api_factory.h" |
| 9 #include "chrome/browser/extensions/api/dial/dial_registry.h" | 9 #include "chrome/browser/extensions/api/dial/dial_registry.h" |
| 10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
| 11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 12 #include "extensions/common/switches.h" | 12 #include "extensions/common/switches.h" |
| 13 #include "extensions/test/extension_test_message_listener.h" | 13 #include "extensions/test/extension_test_message_listener.h" |
| 14 #include "extensions/test/result_catcher.h" | 14 #include "extensions/test/result_catcher.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 17 | 17 |
| 18 using extensions::DialDeviceData; | 18 using extensions::DialDeviceData; |
| 19 using extensions::DialDeviceDescription; |
| 19 using extensions::Extension; | 20 using extensions::Extension; |
| 20 | 21 |
| 21 namespace api = extensions::api; | 22 namespace api = extensions::api; |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 class DialAPITest : public ExtensionApiTest { | 26 class DialAPITest : public ExtensionApiTest { |
| 26 public: | 27 public: |
| 27 DialAPITest() {} | 28 DialAPITest() {} |
| 28 | 29 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 109 |
| 109 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 110 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 110 | 111 |
| 111 listener.Reply("go"); | 112 listener.Reply("go"); |
| 112 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 113 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 113 } | 114 } |
| 114 | 115 |
| 115 IN_PROC_BROWSER_TEST_F(DialAPITest, OnError) { | 116 IN_PROC_BROWSER_TEST_F(DialAPITest, OnError) { |
| 116 ASSERT_TRUE(RunExtensionSubtest("dial/experimental", "on_error.html")); | 117 ASSERT_TRUE(RunExtensionSubtest("dial/experimental", "on_error.html")); |
| 117 } | 118 } |
| 119 |
| 120 IN_PROC_BROWSER_TEST_F(DialAPITest, FetchDeviceDescription) { |
| 121 scoped_refptr<extensions::DialAPI> api = |
| 122 extensions::DialAPIFactory::GetInstance()->GetForBrowserContext( |
| 123 profile()); |
| 124 ASSERT_TRUE(api.get()); |
| 125 |
| 126 DialDeviceData test_device("testDeviceId", |
| 127 GURL("http://127.0.0.1/description.xml"), |
| 128 base::Time::Now()); |
| 129 test_device.set_label("testDevice"); |
| 130 |
| 131 DialDeviceDescription test_description("<xml>testDescription</xml>", |
| 132 GURL("http://127.0.0.1/apps")); |
| 133 api->SetDeviceForTest(test_device, test_description); |
| 134 |
| 135 ASSERT_TRUE(RunExtensionSubtest("dial/experimental", |
| 136 "fetch_device_description.html")); |
| 137 } |
| OLD | NEW |