Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Unified Diff: webkit/glue/web_intent_service_data_unittest.cc

Issue 10541125: Add "scheme" field to WebIntentServiceData object. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add scheme to IPC traits. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/web_intent_service_data.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/web_intent_service_data_unittest.cc
diff --git a/webkit/glue/web_intent_service_data_unittest.cc b/webkit/glue/web_intent_service_data_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..640496a0d63a09edc98ac4b4418bcde3fbb34543
--- /dev/null
+++ b/webkit/glue/web_intent_service_data_unittest.cc
@@ -0,0 +1,82 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <string>
+
+#include "base/utf_string_conversions.h"
+#include "googleurl/src/gurl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "webkit/glue/web_intent_service_data.h"
+
+using webkit_glue::WebIntentServiceData;
+
+namespace {
+
+void Expect(
+ const std::string& action,
+ const std::string& type,
+ const std::string& scheme,
+ const std::string& url,
+ const std::string& title,
+ const WebIntentServiceData::Disposition disposition,
+ const WebIntentServiceData* intent) {
+
+ EXPECT_EQ(GURL(url), intent->service_url);
+ EXPECT_EQ(ASCIIToUTF16(action), intent->action);
+ EXPECT_EQ(ASCIIToUTF16(type), intent->type);
+ EXPECT_EQ(ASCIIToUTF16(scheme), intent->scheme);
+ EXPECT_EQ(ASCIIToUTF16(title), intent->title);
+ EXPECT_EQ(disposition, intent->disposition);
+}
+
+TEST(WebIntentServiceDataTest, Defaults) {
+ WebIntentServiceData intent;
+ EXPECT_EQ(string16(), intent.action);
+ EXPECT_EQ(string16(), intent.type);
+ EXPECT_EQ(string16(), intent.scheme);
+ EXPECT_EQ(string16(), intent.title);
+ EXPECT_EQ(WebIntentServiceData::DISPOSITION_WINDOW, intent.disposition);
+}
+
+TEST(WebIntentServiceDataTest, ActionServicesEqual) {
+
+ // with default disposition...
+ WebIntentServiceData intent = WebIntentServiceData::WebIntentServiceData(
+ ASCIIToUTF16("http://webintents.org/share"),
+ ASCIIToUTF16("image/png"),
+ string16(),
+ GURL("http://abc.com/xyx.html"),
+ ASCIIToUTF16("Image Sharing Service"));
+
+ Expect(
+ "http://webintents.org/share",
+ "image/png",
+ std::string(),
+ "http://abc.com/xyx.html",
+ "Image Sharing Service",
+ WebIntentServiceData::DISPOSITION_WINDOW,
+ &intent);
+}
+
+TEST(WebIntentServiceDataTest, SchemeServicesEqual) {
+
+ // with default disposition...
+ WebIntentServiceData intent = WebIntentServiceData::WebIntentServiceData(
+ string16(),
+ string16(),
+ ASCIIToUTF16("mailto"),
+ GURL("http://abc.com/xyx.html"),
+ ASCIIToUTF16("Image Sharing Service"));
+
+ Expect(
+ "",
+ "",
+ "mailto",
+ "http://abc.com/xyx.html",
+ "Image Sharing Service",
+ WebIntentServiceData::DISPOSITION_WINDOW,
+ &intent);
+}
+
+} // namespace
« no previous file with comments | « webkit/glue/web_intent_service_data.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698