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

Side by Side Diff: chrome/browser/web_applications/web_app_unittest.cc

Issue 2942583004: Move *GetWebApplicationInfo IPCs from "view" to "frame". (Closed)
Patch Set: Rebasing... Created 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/tab_helper.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory> 7 #include <memory>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 28 matching lines...) Expand all
39 const base::string16 title = base::ASCIIToUTF16("TEST_TITLE"); 39 const base::string16 title = base::ASCIIToUTF16("TEST_TITLE");
40 const base::string16 description = base::ASCIIToUTF16("TEST_DESCRIPTION"); 40 const base::string16 description = base::ASCIIToUTF16("TEST_DESCRIPTION");
41 const GURL url("http://www.foo.com/bar"); 41 const GURL url("http://www.foo.com/bar");
42 WebApplicationInfo web_app_info; 42 WebApplicationInfo web_app_info;
43 web_app_info.title = title; 43 web_app_info.title = title;
44 web_app_info.description = description; 44 web_app_info.description = description;
45 web_app_info.app_url = url; 45 web_app_info.app_url = url;
46 46
47 content::RenderFrameHostTester::For(main_rfh()) 47 content::RenderFrameHostTester::For(main_rfh())
48 ->InitializeRenderFrameIfNeeded(); 48 ->InitializeRenderFrameIfNeeded();
49 RenderViewHostTester::TestOnMessageReceived( 49 content::RenderFrameHostTester::TestOnMessageReceived(
50 rvh(), ChromeViewHostMsg_DidGetWebApplicationInfo(0, web_app_info)); 50 rvh()->GetMainFrame(),
51 ChromeFrameHostMsg_DidGetWebApplicationInfo(0, web_app_info));
51 std::unique_ptr<web_app::ShortcutInfo> info = 52 std::unique_ptr<web_app::ShortcutInfo> info =
52 web_app::GetShortcutInfoForTab(web_contents()); 53 web_app::GetShortcutInfoForTab(web_contents());
53 54
54 EXPECT_EQ(title, info->title); 55 EXPECT_EQ(title, info->title);
55 EXPECT_EQ(description, info->description); 56 EXPECT_EQ(description, info->description);
56 EXPECT_EQ(url, info->url); 57 EXPECT_EQ(url, info->url);
57 } 58 }
58 #endif 59 #endif
59 60
60 #if BUILDFLAG(ENABLE_EXTENSIONS) 61 #if BUILDFLAG(ENABLE_EXTENSIONS)
61 TEST_F(WebApplicationTest, AppDirWithId) { 62 TEST_F(WebApplicationTest, AppDirWithId) {
62 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); 63 base::FilePath profile_path(FILE_PATH_LITERAL("profile"));
63 base::FilePath result( 64 base::FilePath result(
64 web_app::GetWebAppDataDirectory(profile_path, "123", GURL())); 65 web_app::GetWebAppDataDirectory(profile_path, "123", GURL()));
65 base::FilePath expected = profile_path.AppendASCII("Web Applications") 66 base::FilePath expected = profile_path.AppendASCII("Web Applications")
66 .AppendASCII("_crx_123"); 67 .AppendASCII("_crx_123");
67 EXPECT_EQ(expected, result); 68 EXPECT_EQ(expected, result);
68 } 69 }
69 70
70 TEST_F(WebApplicationTest, AppDirWithUrl) { 71 TEST_F(WebApplicationTest, AppDirWithUrl) {
71 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); 72 base::FilePath profile_path(FILE_PATH_LITERAL("profile"));
72 base::FilePath result(web_app::GetWebAppDataDirectory( 73 base::FilePath result(web_app::GetWebAppDataDirectory(
73 profile_path, std::string(), GURL("http://example.com"))); 74 profile_path, std::string(), GURL("http://example.com")));
74 base::FilePath expected = profile_path.AppendASCII("Web Applications") 75 base::FilePath expected = profile_path.AppendASCII("Web Applications")
75 .AppendASCII("example.com").AppendASCII("http_80"); 76 .AppendASCII("example.com").AppendASCII("http_80");
76 EXPECT_EQ(expected, result); 77 EXPECT_EQ(expected, result);
77 } 78 }
78 #endif // ENABLE_EXTENSIONS 79 #endif // ENABLE_EXTENSIONS
OLDNEW
« no previous file with comments | « chrome/browser/extensions/tab_helper.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698