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/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/platform_file.h" | 8 #include "base/platform_file.h" |
9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
10 #include "base/version.h" | 10 #include "base/version.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 MockProfileDelegate delegate; | 66 MockProfileDelegate delegate; |
67 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); | 67 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, true)); |
68 | 68 |
69 scoped_ptr<Profile> profile(Profile::CreateProfile( | 69 scoped_ptr<Profile> profile(Profile::CreateProfile( |
70 temp_dir.path(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); | 70 temp_dir.path(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); |
71 ASSERT_TRUE(profile.get()); | 71 ASSERT_TRUE(profile.get()); |
72 CheckChromeVersion(profile.get(), true); | 72 CheckChromeVersion(profile.get(), true); |
73 } | 73 } |
74 | 74 |
| 75 #if defined(OS_WIN) |
| 76 #define MAYBE_CreateOldProfileSynchronous DISABLED_CreateOldProfileSynchronous |
| 77 #else |
| 78 #define MAYBE_CreateOldProfileSynchronous CreateOldProfileSynchronous |
| 79 #endif |
| 80 |
75 // Test OnProfileCreate is called with is_new_profile set to false when | 81 // Test OnProfileCreate is called with is_new_profile set to false when |
76 // creating a profile synchronously with an existing prefs file. | 82 // creating a profile synchronously with an existing prefs file. |
77 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileSynchronous) { | 83 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, MAYBE_CreateOldProfileSynchronous) { |
78 ScopedTempDir temp_dir; | 84 ScopedTempDir temp_dir; |
79 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 85 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
80 CreatePrefsFileInDirectory(temp_dir.path()); | 86 CreatePrefsFileInDirectory(temp_dir.path()); |
81 | 87 |
82 MockProfileDelegate delegate; | 88 MockProfileDelegate delegate; |
83 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false)); | 89 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false)); |
84 | 90 |
85 scoped_ptr<Profile> profile(Profile::CreateProfile( | 91 scoped_ptr<Profile> profile(Profile::CreateProfile( |
86 temp_dir.path(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); | 92 temp_dir.path(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); |
87 ASSERT_TRUE(profile.get()); | 93 ASSERT_TRUE(profile.get()); |
(...skipping 14 matching lines...) Expand all Loading... |
102 ASSERT_TRUE(profile.get()); | 108 ASSERT_TRUE(profile.get()); |
103 | 109 |
104 // Wait for the profile to be created. | 110 // Wait for the profile to be created. |
105 content::WindowedNotificationObserver observer( | 111 content::WindowedNotificationObserver observer( |
106 chrome::NOTIFICATION_PROFILE_CREATED, | 112 chrome::NOTIFICATION_PROFILE_CREATED, |
107 content::Source<Profile>(profile.get())); | 113 content::Source<Profile>(profile.get())); |
108 observer.Wait(); | 114 observer.Wait(); |
109 CheckChromeVersion(profile.get(), true); | 115 CheckChromeVersion(profile.get(), true); |
110 } | 116 } |
111 | 117 |
| 118 #if defined(OS_WIN) |
| 119 #define MAYBE_CreateOldProfileAsynchronous DISABLED_CreateOldProfileAsynchronous |
| 120 #else |
| 121 #define MAYBE_CreateOldProfileAsynchronous CreateOldProfileAsynchronous |
| 122 #endif |
| 123 |
112 // Test OnProfileCreate is called with is_new_profile set to false when | 124 // Test OnProfileCreate is called with is_new_profile set to false when |
113 // creating a profile asynchronously with an existing prefs file. | 125 // creating a profile asynchronously with an existing prefs file. |
114 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, CreateOldProfileAsynchronous) { | 126 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, MAYBE_CreateOldProfileAsynchronous) { |
115 ScopedTempDir temp_dir; | 127 ScopedTempDir temp_dir; |
116 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 128 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
117 CreatePrefsFileInDirectory(temp_dir.path()); | 129 CreatePrefsFileInDirectory(temp_dir.path()); |
118 | 130 |
119 MockProfileDelegate delegate; | 131 MockProfileDelegate delegate; |
120 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false)); | 132 EXPECT_CALL(delegate, OnProfileCreated(testing::NotNull(), true, false)); |
121 scoped_ptr<Profile> profile(Profile::CreateProfile( | 133 scoped_ptr<Profile> profile(Profile::CreateProfile( |
122 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); | 134 temp_dir.path(), &delegate, Profile::CREATE_MODE_ASYNCHRONOUS)); |
123 ASSERT_TRUE(profile.get()); | 135 ASSERT_TRUE(profile.get()); |
124 | 136 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 scoped_ptr<Profile> profile(Profile::CreateProfile( | 185 scoped_ptr<Profile> profile(Profile::CreateProfile( |
174 temp_dir.path(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); | 186 temp_dir.path(), &delegate, Profile::CREATE_MODE_SYNCHRONOUS)); |
175 ASSERT_TRUE(profile.get()); | 187 ASSERT_TRUE(profile.get()); |
176 | 188 |
177 // Delete the Profile instance and run pending tasks (this includes the task | 189 // Delete the Profile instance and run pending tasks (this includes the task |
178 // for README creation). | 190 // for README creation). |
179 profile.reset(); | 191 profile.reset(); |
180 content::RunAllPendingInMessageLoop(); | 192 content::RunAllPendingInMessageLoop(); |
181 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); | 193 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); |
182 } | 194 } |
OLD | NEW |