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

Side by Side Diff: chrome/browser/profiles/profile_browsertest.cc

Issue 271533004: Turning on MultiProfile by default for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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/profiles/profile.h" 5 #include "chrome/browser/profiles/profile.h"
6 6
7 #include "base/command_line.h"
7 #include "base/file_util.h" 8 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
9 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
10 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
11 #include "base/version.h" 12 #include "base/version.h"
12 #include "chrome/browser/chrome_notification_types.h" 13 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/profiles/chrome_version_service.h" 14 #include "chrome/browser/profiles/chrome_version_service.h"
14 #include "chrome/browser/profiles/profile_impl.h" 15 #include "chrome/browser/profiles/profile_impl.h"
15 #include "chrome/browser/profiles/startup_task_runner_service.h" 16 #include "chrome/browser/profiles/startup_task_runner_service.h"
16 #include "chrome/browser/profiles/startup_task_runner_service_factory.h" 17 #include "chrome/browser/profiles/startup_task_runner_service_factory.h"
17 #include "chrome/common/chrome_constants.h" 18 #include "chrome/common/chrome_constants.h"
18 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "chrome/test/base/in_process_browser_test.h" 21 #include "chrome/test/base/in_process_browser_test.h"
21 #include "chrome/test/base/ui_test_utils.h" 22 #include "chrome/test/base/ui_test_utils.h"
22 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 25
26 #if defined(OS_CHROMEOS)
27 #include "chromeos/chromeos_switches.h"
28 #endif
29
25 namespace { 30 namespace {
26 31
27 class MockProfileDelegate : public Profile::Delegate { 32 class MockProfileDelegate : public Profile::Delegate {
28 public: 33 public:
29 MOCK_METHOD1(OnPrefsLoaded, void(Profile*)); 34 MOCK_METHOD1(OnPrefsLoaded, void(Profile*));
30 MOCK_METHOD3(OnProfileCreated, void(Profile*, bool, bool)); 35 MOCK_METHOD3(OnProfileCreated, void(Profile*, bool, bool));
31 }; 36 };
32 37
33 // Creates a prefs file in the given directory. 38 // Creates a prefs file in the given directory.
34 void CreatePrefsFileInDirectory(const base::FilePath& directory_path) { 39 void CreatePrefsFileInDirectory(const base::FilePath& directory_path) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 // deleting scoped temp dir etc). 82 // deleting scoped temp dir etc).
78 // Should not be necessary anymore once Profile deletion is fixed 83 // Should not be necessary anymore once Profile deletion is fixed
79 // (see crbug.com/88586). 84 // (see crbug.com/88586).
80 content::RunAllPendingInMessageLoop(); 85 content::RunAllPendingInMessageLoop();
81 content::RunAllPendingInMessageLoop(content::BrowserThread::DB); 86 content::RunAllPendingInMessageLoop(content::BrowserThread::DB);
82 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); 87 content::RunAllPendingInMessageLoop(content::BrowserThread::FILE);
83 } 88 }
84 89
85 } // namespace 90 } // namespace
86 91
87 typedef InProcessBrowserTest ProfileBrowserTest; 92 class ProfileBrowserTest : public InProcessBrowserTest {
93 protected:
94 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
95 #if defined(OS_CHROMEOS)
96 command_line->AppendSwitch(
97 chromeos::switches::kIgnoreUserProfileMappingForTests);
98 #endif
99 }
100 };
88 101
89 // Test OnProfileCreate is called with is_new_profile set to true when 102 // Test OnProfileCreate is called with is_new_profile set to true when
90 // creating a new profile synchronously. 103 // creating a new profile synchronously.
91 // 104 //
92 // Flaky (sometimes timeout): http://crbug.com/141141 105 // Flaky (sometimes timeout): http://crbug.com/141141
93 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, 106 IN_PROC_BROWSER_TEST_F(ProfileBrowserTest,
94 DISABLED_CreateNewProfileSynchronous) { 107 DISABLED_CreateNewProfileSynchronous) {
95 base::ScopedTempDir temp_dir; 108 base::ScopedTempDir temp_dir;
96 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 109 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
97 110
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 EXPECT_EQ(first_call_value, second_call_value); 297 EXPECT_EQ(first_call_value, second_call_value);
285 298
286 // Setting back to a crashed value should work. 299 // Setting back to a crashed value should work.
287 profile->SetExitType(Profile::EXIT_CRASHED); 300 profile->SetExitType(Profile::EXIT_CRASHED);
288 std::string final_value(prefs->GetString(prefs::kSessionExitType)); 301 std::string final_value(prefs->GetString(prefs::kSessionExitType));
289 EXPECT_EQ(crash_value, final_value); 302 EXPECT_EQ(crash_value, final_value);
290 } 303 }
291 304
292 SpinThreads(); 305 SpinThreads();
293 } 306 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_hash_browsertest.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698