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

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

Issue 7892007: Add ChromeRenderViewHostTestHarness to get rid of the dependency from RVHTH to profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/visitedlink/visitedlink_unittest.cc ('k') | chrome/chrome_tests.gypi » ('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) 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"
11 #include "chrome/browser/ui/web_applications/web_app_ui.h" 11 #include "chrome/browser/ui/web_applications/web_app_ui.h"
12 #include "chrome/common/extensions/extension_messages.h" 12 #include "chrome/common/extensions/extension_messages.h"
13 #include "chrome/test/base/testing_profile.h" 13 #include "chrome/test/base/testing_profile.h"
14 #include "content/browser/browser_thread.h" 14 #include "content/browser/browser_thread.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 class WebApplicationTest : public TabContentsWrapperTestHarness { 17 class WebApplicationTest : public TabContentsWrapperTestHarness {
18 public: 18 public:
19 WebApplicationTest() 19 WebApplicationTest() : ui_thread_(BrowserThread::UI, &message_loop_) {
20 : TabContentsWrapperTestHarness(),
21 ui_thread_(BrowserThread::UI, &message_loop_) {
22 } 20 }
23 21
24 private: 22 private:
25 // Supply our own profile so we use the correct profile data. The test harness
26 // is not supposed to overwrite a profile if it's already created.
27 virtual void SetUp() {
28 profile_.reset(new TestingProfile());
29
30 TabContentsWrapperTestHarness::SetUp();
31 }
32
33 virtual void TearDown() {
34 TabContentsWrapperTestHarness::TearDown();
35
36 profile_.reset(NULL);
37 }
38
39 BrowserThread ui_thread_; 23 BrowserThread ui_thread_;
40 }; 24 };
41 25
42 TEST_F(WebApplicationTest, GetShortcutInfoForTab) { 26 TEST_F(WebApplicationTest, GetShortcutInfoForTab) {
43 const string16 title = ASCIIToUTF16("TEST_TITLE"); 27 const string16 title = ASCIIToUTF16("TEST_TITLE");
44 const string16 description = ASCIIToUTF16("TEST_DESCRIPTION"); 28 const string16 description = ASCIIToUTF16("TEST_DESCRIPTION");
45 const GURL url("http://www.foo.com/bar"); 29 const GURL url("http://www.foo.com/bar");
46 WebApplicationInfo web_app_info; 30 WebApplicationInfo web_app_info;
47 web_app_info.title = title; 31 web_app_info.title = title;
48 web_app_info.description = description; 32 web_app_info.description = description;
49 web_app_info.app_url = url; 33 web_app_info.app_url = url;
50 34
51 rvh()->TestOnMessageReceived( 35 rvh()->TestOnMessageReceived(
52 ExtensionHostMsg_DidGetApplicationInfo(0, 0, web_app_info)); 36 ExtensionHostMsg_DidGetApplicationInfo(0, 0, web_app_info));
53 ShellIntegration::ShortcutInfo info; 37 ShellIntegration::ShortcutInfo info;
54 web_app::GetShortcutInfoForTab(contents_wrapper(), &info); 38 web_app::GetShortcutInfoForTab(contents_wrapper(), &info);
55 39
56 EXPECT_EQ(title, info.title); 40 EXPECT_EQ(title, info.title);
57 EXPECT_EQ(description, info.description); 41 EXPECT_EQ(description, info.description);
58 EXPECT_EQ(url, info.url); 42 EXPECT_EQ(url, info.url);
59 } 43 }
60 44
61 TEST_F(WebApplicationTest, GetDataDir) { 45 TEST_F(WebApplicationTest, GetDataDir) {
62 FilePath test_path(FILE_PATH_LITERAL("/path/to/test")); 46 FilePath test_path(FILE_PATH_LITERAL("/path/to/test"));
63 FilePath result = web_app::GetDataDir(test_path); 47 FilePath result = web_app::GetDataDir(test_path);
64 test_path = test_path.AppendASCII("Web Applications"); 48 test_path = test_path.AppendASCII("Web Applications");
65 EXPECT_EQ(test_path.value(), result.value()); 49 EXPECT_EQ(test_path.value(), result.value());
66 } 50 }
OLDNEW
« no previous file with comments | « chrome/browser/visitedlink/visitedlink_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698