| 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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #if defined(TOOLKIT_VIEWS) | 35 #if defined(TOOLKIT_VIEWS) |
| 36 TEST_F(WebApplicationTest, GetShortcutInfoForTab) { | 36 TEST_F(WebApplicationTest, GetShortcutInfoForTab) { |
| 37 const base::string16 title = base::ASCIIToUTF16("TEST_TITLE"); | 37 const base::string16 title = base::ASCIIToUTF16("TEST_TITLE"); |
| 38 const base::string16 description = base::ASCIIToUTF16("TEST_DESCRIPTION"); | 38 const base::string16 description = base::ASCIIToUTF16("TEST_DESCRIPTION"); |
| 39 const GURL url("http://www.foo.com/bar"); | 39 const GURL url("http://www.foo.com/bar"); |
| 40 WebApplicationInfo web_app_info; | 40 WebApplicationInfo web_app_info; |
| 41 web_app_info.title = title; | 41 web_app_info.title = title; |
| 42 web_app_info.description = description; | 42 web_app_info.description = description; |
| 43 web_app_info.app_url = url; | 43 web_app_info.app_url = url; |
| 44 | 44 |
| 45 content::RenderFrameHostTester::For(main_rfh()) |
| 46 ->InitializeRenderFrameIfNeeded(); |
| 45 RenderViewHostTester::TestOnMessageReceived( | 47 RenderViewHostTester::TestOnMessageReceived( |
| 46 rvh(), ChromeViewHostMsg_DidGetWebApplicationInfo(0, web_app_info)); | 48 rvh(), ChromeViewHostMsg_DidGetWebApplicationInfo(0, web_app_info)); |
| 47 scoped_ptr<web_app::ShortcutInfo> info = | 49 scoped_ptr<web_app::ShortcutInfo> info = |
| 48 web_app::GetShortcutInfoForTab(web_contents()); | 50 web_app::GetShortcutInfoForTab(web_contents()); |
| 49 | 51 |
| 50 EXPECT_EQ(title, info->title); | 52 EXPECT_EQ(title, info->title); |
| 51 EXPECT_EQ(description, info->description); | 53 EXPECT_EQ(description, info->description); |
| 52 EXPECT_EQ(url, info->url); | 54 EXPECT_EQ(url, info->url); |
| 53 } | 55 } |
| 54 #endif | 56 #endif |
| (...skipping 10 matching lines...) Expand all Loading... |
| 65 | 67 |
| 66 TEST_F(WebApplicationTest, AppDirWithUrl) { | 68 TEST_F(WebApplicationTest, AppDirWithUrl) { |
| 67 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); | 69 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); |
| 68 base::FilePath result(web_app::GetWebAppDataDirectory( | 70 base::FilePath result(web_app::GetWebAppDataDirectory( |
| 69 profile_path, std::string(), GURL("http://example.com"))); | 71 profile_path, std::string(), GURL("http://example.com"))); |
| 70 base::FilePath expected = profile_path.AppendASCII("Web Applications") | 72 base::FilePath expected = profile_path.AppendASCII("Web Applications") |
| 71 .AppendASCII("example.com").AppendASCII("http_80"); | 73 .AppendASCII("example.com").AppendASCII("http_80"); |
| 72 EXPECT_EQ(expected, result); | 74 EXPECT_EQ(expected, result); |
| 73 } | 75 } |
| 74 #endif // ENABLE_EXTENSIONS | 76 #endif // ENABLE_EXTENSIONS |
| OLD | NEW |