| 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 "googleurl/src/gurl.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "webkit/glue/web_intent_service_data.h" |
| 11 |
| 12 using webkit_glue::WebIntentServiceData; |
| 13 |
| 14 namespace { |
| 15 |
| 16 void Expect( |
| 17 const std::string& action, |
| 18 const std::string& type, |
| 19 const std::string& scheme, |
| 20 const std::string& url, |
| 21 const std::string& title, |
| 22 const WebIntentServiceData::Disposition disposition, |
| 23 const WebIntentServiceData* intent) { |
| 24 |
| 25 EXPECT_EQ(GURL(url), intent->service_url); |
| 26 EXPECT_EQ(ASCIIToUTF16(action), intent->action); |
| 27 EXPECT_EQ(ASCIIToUTF16(type), intent->type); |
| 28 EXPECT_EQ(ASCIIToUTF16(scheme), intent->scheme); |
| 29 EXPECT_EQ(ASCIIToUTF16(title), intent->title); |
| 30 EXPECT_EQ(disposition, intent->disposition); |
| 31 } |
| 32 |
| 33 TEST(WebIntentServiceDataTest, Defaults) { |
| 34 WebIntentServiceData intent; |
| 35 EXPECT_EQ(string16(), intent.action); |
| 36 EXPECT_EQ(string16(), intent.type); |
| 37 EXPECT_EQ(string16(), intent.scheme); |
| 38 EXPECT_EQ(string16(), intent.title); |
| 39 EXPECT_EQ(WebIntentServiceData::DISPOSITION_WINDOW, intent.disposition); |
| 40 } |
| 41 |
| 42 TEST(WebIntentServiceDataTest, ActionServicesEqual) { |
| 43 |
| 44 // with default disposition... |
| 45 WebIntentServiceData intent = WebIntentServiceData::WebIntentServiceData( |
| 46 ASCIIToUTF16("http://webintents.org/share"), |
| 47 ASCIIToUTF16("image/png"), |
| 48 string16(), |
| 49 GURL("http://abc.com/xyx.html"), |
| 50 ASCIIToUTF16("Image Sharing Service")); |
| 51 |
| 52 Expect( |
| 53 "http://webintents.org/share", |
| 54 "image/png", |
| 55 std::string(), |
| 56 "http://abc.com/xyx.html", |
| 57 "Image Sharing Service", |
| 58 WebIntentServiceData::DISPOSITION_WINDOW, |
| 59 &intent); |
| 60 } |
| 61 |
| 62 TEST(WebIntentServiceDataTest, SchemeServicesEqual) { |
| 63 |
| 64 // with default disposition... |
| 65 WebIntentServiceData intent = WebIntentServiceData::WebIntentServiceData( |
| 66 string16(), |
| 67 string16(), |
| 68 ASCIIToUTF16("mailto"), |
| 69 GURL("http://abc.com/xyx.html"), |
| 70 ASCIIToUTF16("Image Sharing Service")); |
| 71 |
| 72 Expect( |
| 73 "", |
| 74 "", |
| 75 "mailto", |
| 76 "http://abc.com/xyx.html", |
| 77 "Image Sharing Service", |
| 78 WebIntentServiceData::DISPOSITION_WINDOW, |
| 79 &intent); |
| 80 } |
| 81 |
| 82 } // namespace |
| OLD | NEW |