| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/web_applications/web_app.h" | 5 #include "chrome/browser/web_applications/web_app.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const base::string16 description = base::ASCIIToUTF16("TEST_DESCRIPTION"); | 36 const base::string16 description = base::ASCIIToUTF16("TEST_DESCRIPTION"); |
| 37 const GURL url("http://www.foo.com/bar"); | 37 const GURL url("http://www.foo.com/bar"); |
| 38 WebApplicationInfo web_app_info; | 38 WebApplicationInfo web_app_info; |
| 39 web_app_info.title = title; | 39 web_app_info.title = title; |
| 40 web_app_info.description = description; | 40 web_app_info.description = description; |
| 41 web_app_info.app_url = url; | 41 web_app_info.app_url = url; |
| 42 | 42 |
| 43 RenderViewHostTester::TestOnMessageReceived( | 43 RenderViewHostTester::TestOnMessageReceived( |
| 44 rvh(), | 44 rvh(), |
| 45 ChromeExtensionHostMsg_DidGetApplicationInfo(0, 0, web_app_info)); | 45 ChromeExtensionHostMsg_DidGetApplicationInfo(0, 0, web_app_info)); |
| 46 ShellIntegration::ShortcutInfo info; | 46 web_app::ShortcutInfo info; |
| 47 web_app::GetShortcutInfoForTab(web_contents(), &info); | 47 web_app::GetShortcutInfoForTab(web_contents(), &info); |
| 48 | 48 |
| 49 EXPECT_EQ(title, info.title); | 49 EXPECT_EQ(title, info.title); |
| 50 EXPECT_EQ(description, info.description); | 50 EXPECT_EQ(description, info.description); |
| 51 EXPECT_EQ(url, info.url); | 51 EXPECT_EQ(url, info.url); |
| 52 } | 52 } |
| 53 | 53 |
| 54 TEST_F(WebApplicationTest, AppDirWithId) { | 54 TEST_F(WebApplicationTest, AppDirWithId) { |
| 55 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); | 55 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); |
| 56 base::FilePath result( | 56 base::FilePath result( |
| 57 web_app::GetWebAppDataDirectory(profile_path, "123", GURL())); | 57 web_app::GetWebAppDataDirectory(profile_path, "123", GURL())); |
| 58 base::FilePath expected = profile_path.AppendASCII("Web Applications") | 58 base::FilePath expected = profile_path.AppendASCII("Web Applications") |
| 59 .AppendASCII("_crx_123"); | 59 .AppendASCII("_crx_123"); |
| 60 EXPECT_EQ(expected, result); | 60 EXPECT_EQ(expected, result); |
| 61 } | 61 } |
| 62 | 62 |
| 63 TEST_F(WebApplicationTest, AppDirWithUrl) { | 63 TEST_F(WebApplicationTest, AppDirWithUrl) { |
| 64 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); | 64 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); |
| 65 base::FilePath result(web_app::GetWebAppDataDirectory( | 65 base::FilePath result(web_app::GetWebAppDataDirectory( |
| 66 profile_path, std::string(), GURL("http://example.com"))); | 66 profile_path, std::string(), GURL("http://example.com"))); |
| 67 base::FilePath expected = profile_path.AppendASCII("Web Applications") | 67 base::FilePath expected = profile_path.AppendASCII("Web Applications") |
| 68 .AppendASCII("example.com").AppendASCII("http_80"); | 68 .AppendASCII("example.com").AppendASCII("http_80"); |
| 69 EXPECT_EQ(expected, result); | 69 EXPECT_EQ(expected, result); |
| 70 } | 70 } |
| OLD | NEW |