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

Unified Diff: chrome/browser/web_applications/web_app_unittest.cc

Issue 2826019: Add tests for chrome/browser/web_applications and mark some code as Win32 and... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 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 | « chrome/browser/web_applications/web_app.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_applications/web_app_unittest.cc
===================================================================
--- chrome/browser/web_applications/web_app_unittest.cc (revision 0)
+++ chrome/browser/web_applications/web_app_unittest.cc (revision 0)
@@ -0,0 +1,63 @@
+// Copyright (c) 2010 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 "chrome/browser/web_applications/web_app.h"
+
+#include "base/file_path.h"
+#include "base/string_util.h"
+#include "chrome/browser/renderer_host/test/test_render_view_host.h"
+#include "chrome/common/render_messages.h"
+#include "chrome/test/testing_profile.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class WebApplicationTest : public RenderViewHostTestHarness {
+ public:
+ WebApplicationTest()
+ : RenderViewHostTestHarness(),
+ ui_thread_(ChromeThread::UI, &message_loop_) {
+ }
+
+ private:
+ // Supply our own profile so we use the correct profile data. The test harness
+ // is not supposed to overwrite a profile if it's already created.
+ virtual void SetUp() {
+ profile_.reset(new TestingProfile());
+
+ RenderViewHostTestHarness::SetUp();
+ }
+
+ virtual void TearDown() {
+ RenderViewHostTestHarness::TearDown();
+
+ profile_.reset(NULL);
+ }
+
+ ChromeThread ui_thread_;
+};
+
+TEST_F(WebApplicationTest, GetShortcutInfoForTab) {
+ const string16 title = ASCIIToUTF16("TEST_TITLE");
+ const string16 description = ASCIIToUTF16("TEST_DESCRIPTION");
+ const GURL url("http://www.foo.com/bar");
+ webkit_glue::WebApplicationInfo web_app_info;
+ web_app_info.title = title;
+ web_app_info.description = description;
+ web_app_info.app_url = url;
+
+ rvh()->TestOnMessageReceived(
+ ViewHostMsg_DidGetApplicationInfo(0, 0, web_app_info));
+ ShellIntegration::ShortcutInfo info;
+ web_app::GetShortcutInfoForTab(contents(), &info);
+
+ EXPECT_EQ(title, info.title);
+ EXPECT_EQ(description, info.description);
+ EXPECT_EQ(url, info.url);
+}
+
+TEST_F(WebApplicationTest, GetDataDir) {
+ FilePath test_path(FILE_PATH_LITERAL("/path/to/test"));
+ FilePath result = web_app::GetDataDir(FilePath(FILE_PATH_LITERAL(test_path)));
+ test_path = test_path.AppendASCII("Web Applications");
+ EXPECT_EQ(test_path.value(), result.value());
+}
Property changes on: chrome/browser/web_applications/web_app_unittest.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/web_applications/web_app.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698