| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <string> | |
| 6 #include <vector> | |
| 7 | |
| 8 #include "base/command_line.h" | |
| 9 #include "base/utf_string_conversions.h" | |
| 10 #include "chrome/browser/intents/native_services.h" | |
| 11 #include "chrome/browser/intents/web_intents_util.h" | |
| 12 #include "chrome/common/chrome_switches.h" | |
| 13 #include "extensions/common/url_pattern.h" | |
| 14 #include "googleurl/src/gurl.h" | |
| 15 #include "testing/gtest/include/gtest/gtest.h" | |
| 16 #include "webkit/glue/web_intent_service_data.h" | |
| 17 | |
| 18 namespace { | |
| 19 | |
| 20 TEST(NativeServiceRegistryTest, GetSupportedServices) { | |
| 21 #if !defined(ANDROID) | |
| 22 // enable native services feature, then check results again | |
| 23 CommandLine::ForCurrentProcess()->AppendSwitch( | |
| 24 switches::kWebIntentsNativeServicesEnabled); | |
| 25 | |
| 26 web_intents::IntentServiceList services; | |
| 27 web_intents::NativeServiceRegistry registry; | |
| 28 | |
| 29 registry.GetSupportedServices(ASCIIToUTF16("dothedew"), &services); | |
| 30 | |
| 31 ASSERT_EQ(0U, services.size()); | |
| 32 | |
| 33 registry.GetSupportedServices( | |
| 34 ASCIIToUTF16(web_intents::kActionPick), &services); | |
| 35 | |
| 36 ASSERT_EQ(1U, services.size()); | |
| 37 | |
| 38 // verify the service returned is for "pick" | |
| 39 EXPECT_EQ(ASCIIToUTF16(web_intents::kActionPick), services[0].action); | |
| 40 EXPECT_EQ(GURL(web_intents::kNativeFilePickerUrl), services[0].service_url); | |
| 41 #endif | |
| 42 } | |
| 43 | |
| 44 TEST(NativeServiceRegistryTest, GetSupportedServicesDisabled) { | |
| 45 #if !defined(ANDROID) | |
| 46 web_intents::IntentServiceList services; | |
| 47 web_intents::NativeServiceRegistry registry; | |
| 48 | |
| 49 registry.GetSupportedServices( | |
| 50 ASCIIToUTF16(web_intents::kActionPick), &services); | |
| 51 | |
| 52 ASSERT_EQ(0U, services.size()); | |
| 53 #endif | |
| 54 } | |
| 55 | |
| 56 } // namespace | |
| OLD | NEW |