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/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/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
11 #include "chrome/browser/favicon/favicon_tab_helper.h" | 11 #include "chrome/browser/favicon/favicon_tab_helper.h" |
12 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 12 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
13 #include "chrome/common/extensions/extension_messages.h" | 13 #include "chrome/common/extensions/extension_messages.h" |
14 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 14 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
15 #include "content/public/test/test_browser_thread.h" | |
16 #include "content/public/test/test_renderer_host.h" | 15 #include "content/public/test/test_renderer_host.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 | 17 |
19 using content::BrowserThread; | |
20 using content::RenderViewHostTester; | 18 using content::RenderViewHostTester; |
21 | 19 |
22 class WebApplicationTest : public ChromeRenderViewHostTestHarness { | 20 class WebApplicationTest : public ChromeRenderViewHostTestHarness { |
23 public: | 21 protected: |
24 WebApplicationTest() : ui_thread_(BrowserThread::UI, &message_loop_) { | |
25 } | |
26 | |
27 private: | |
28 virtual void SetUp() OVERRIDE { | 22 virtual void SetUp() OVERRIDE { |
29 ChromeRenderViewHostTestHarness::SetUp(); | 23 ChromeRenderViewHostTestHarness::SetUp(); |
30 extensions::TabHelper::CreateForWebContents(web_contents()); | 24 extensions::TabHelper::CreateForWebContents(web_contents()); |
31 FaviconTabHelper::CreateForWebContents(web_contents()); | 25 FaviconTabHelper::CreateForWebContents(web_contents()); |
32 } | 26 } |
33 | |
34 content::TestBrowserThread ui_thread_; | |
35 }; | 27 }; |
36 | 28 |
37 #if defined(OS_MACOSX) | 29 #if defined(OS_MACOSX) |
38 #define MAYBE_GetShortcutInfoForTab DISABLED_GetShortcutInfoForTab | 30 #define MAYBE_GetShortcutInfoForTab DISABLED_GetShortcutInfoForTab |
39 #else | 31 #else |
40 #define MAYBE_GetShortcutInfoForTab GetShortcutInfoForTab | 32 #define MAYBE_GetShortcutInfoForTab GetShortcutInfoForTab |
41 #endif | 33 #endif |
42 TEST_F(WebApplicationTest, MAYBE_GetShortcutInfoForTab) { | 34 TEST_F(WebApplicationTest, MAYBE_GetShortcutInfoForTab) { |
43 const string16 title = ASCIIToUTF16("TEST_TITLE"); | 35 const string16 title = ASCIIToUTF16("TEST_TITLE"); |
44 const string16 description = ASCIIToUTF16("TEST_DESCRIPTION"); | 36 const string16 description = ASCIIToUTF16("TEST_DESCRIPTION"); |
(...skipping 24 matching lines...) Expand all Loading... |
69 } | 61 } |
70 | 62 |
71 TEST_F(WebApplicationTest, AppDirWithUrl) { | 63 TEST_F(WebApplicationTest, AppDirWithUrl) { |
72 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); | 64 base::FilePath profile_path(FILE_PATH_LITERAL("profile")); |
73 base::FilePath result(web_app::GetWebAppDataDirectory( | 65 base::FilePath result(web_app::GetWebAppDataDirectory( |
74 profile_path, std::string(), GURL("http://example.com"))); | 66 profile_path, std::string(), GURL("http://example.com"))); |
75 base::FilePath expected = profile_path.AppendASCII("Web Applications") | 67 base::FilePath expected = profile_path.AppendASCII("Web Applications") |
76 .AppendASCII("example.com").AppendASCII("http_80"); | 68 .AppendASCII("example.com").AppendASCII("http_80"); |
77 EXPECT_EQ(expected, result); | 69 EXPECT_EQ(expected, result); |
78 } | 70 } |
OLD | NEW |