OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 rvh()->TestOnMessageReceived( | 37 rvh()->TestOnMessageReceived( |
38 ExtensionHostMsg_DidGetApplicationInfo(0, 0, web_app_info)); | 38 ExtensionHostMsg_DidGetApplicationInfo(0, 0, web_app_info)); |
39 ShellIntegration::ShortcutInfo info; | 39 ShellIntegration::ShortcutInfo info; |
40 web_app::GetShortcutInfoForTab(contents_wrapper(), &info); | 40 web_app::GetShortcutInfoForTab(contents_wrapper(), &info); |
41 | 41 |
42 EXPECT_EQ(title, info.title); | 42 EXPECT_EQ(title, info.title); |
43 EXPECT_EQ(description, info.description); | 43 EXPECT_EQ(description, info.description); |
44 EXPECT_EQ(url, info.url); | 44 EXPECT_EQ(url, info.url); |
45 } | 45 } |
46 | 46 |
47 TEST_F(WebApplicationTest, GetDataDir) { | 47 TEST_F(WebApplicationTest, AppDirWithId) { |
48 FilePath test_path(FILE_PATH_LITERAL("/path/to/test")); | 48 FilePath profile_path(FILE_PATH_LITERAL("profile")); |
49 FilePath result = web_app::GetDataDir(test_path); | 49 FilePath result(web_app::GetWebAppDataDirectory(profile_path, "123", GURL())); |
50 test_path = test_path.AppendASCII("Web Applications"); | 50 FilePath expected = profile_path.AppendASCII("Web Applications") |
51 EXPECT_EQ(test_path.value(), result.value()); | 51 .AppendASCII("_crx_123"); |
| 52 EXPECT_EQ(expected, result); |
52 } | 53 } |
| 54 |
| 55 TEST_F(WebApplicationTest, AppDirWithUrl) { |
| 56 FilePath profile_path(FILE_PATH_LITERAL("profile")); |
| 57 FilePath result(web_app::GetWebAppDataDirectory( |
| 58 profile_path, "", GURL("http://example.com"))); |
| 59 FilePath expected = profile_path.AppendASCII("Web Applications") |
| 60 .AppendASCII("example.com") |
| 61 .AppendASCII("http_80"); |
| 62 EXPECT_EQ(expected, result); |
| 63 } |
OLD | NEW |