| 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 | |
| 7 #include "base/utf_string_conversions.h" | |
| 8 #include "chrome/browser/intents/default_web_intent_service.h" | |
| 9 #include "extensions/common/url_pattern.h" | |
| 10 #include "googleurl/src/gurl.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | |
| 12 | |
| 13 namespace { | |
| 14 | |
| 15 const char kEmptyString[] = ""; | |
| 16 const char kShareAction[] = "http://webintents.org/share"; | |
| 17 const char kPngType[] = "image/png"; | |
| 18 const char kMailToScheme[] = "mailto"; | |
| 19 const char kQuackService[] = "http://ducknet.com/quack"; | |
| 20 const URLPattern all_pattern( | |
| 21 URLPattern::SCHEME_ALL, URLPattern::kAllUrlsPattern); | |
| 22 | |
| 23 TEST(DefaultWebIntentServiceTest, Defaults) { | |
| 24 DefaultWebIntentService service; | |
| 25 | |
| 26 EXPECT_EQ(string16(), service.action); | |
| 27 EXPECT_EQ(string16(), service.type); | |
| 28 EXPECT_EQ(string16(), service.scheme); | |
| 29 EXPECT_EQ(all_pattern, service.url_pattern); | |
| 30 EXPECT_EQ(-1, service.user_date); | |
| 31 EXPECT_EQ(0, service.suppression); | |
| 32 EXPECT_EQ("", service.service_url); | |
| 33 } | |
| 34 | |
| 35 TEST(DefaultWebIntentServiceTest, ActionServicesEqual) { | |
| 36 DefaultWebIntentService actual( | |
| 37 ASCIIToUTF16(kShareAction), | |
| 38 ASCIIToUTF16(kPngType), | |
| 39 kQuackService); | |
| 40 | |
| 41 DefaultWebIntentService expected; | |
| 42 expected.action = ASCIIToUTF16(kShareAction); | |
| 43 expected.type = ASCIIToUTF16(kPngType); | |
| 44 expected.service_url = kQuackService; | |
| 45 | |
| 46 EXPECT_EQ(expected, actual); | |
| 47 } | |
| 48 | |
| 49 TEST(DefaultWebIntentServiceTest, SchemeServicesEqual) { | |
| 50 DefaultWebIntentService actual( | |
| 51 ASCIIToUTF16(kMailToScheme), | |
| 52 kQuackService); | |
| 53 | |
| 54 DefaultWebIntentService expected; | |
| 55 expected.scheme = ASCIIToUTF16(kMailToScheme); | |
| 56 expected.service_url = kQuackService; | |
| 57 | |
| 58 EXPECT_EQ(expected, actual); | |
| 59 } | |
| 60 | |
| 61 } // namespace | |
| OLD | NEW |