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 "base/command_line.h" |
5 #include "chrome/browser/browser_process.h" | 6 #include "chrome/browser/browser_process.h" |
6 #include "chrome/browser/first_run/first_run.h" | 7 #include "chrome/browser/first_run/first_run.h" |
7 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "chrome/common/chrome_switches.h" |
8 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
| 13 #include "content/public/test/test_launcher.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
11 | 15 |
12 typedef InProcessBrowserTest FirstRunBrowserTest; | 16 typedef InProcessBrowserTest FirstRunBrowserTest; |
13 | 17 |
14 IN_PROC_BROWSER_TEST_F(FirstRunBrowserTest, SetShowFirstRunBubblePref) { | 18 IN_PROC_BROWSER_TEST_F(FirstRunBrowserTest, SetShowFirstRunBubblePref) { |
15 EXPECT_TRUE(g_browser_process->local_state()->FindPreference( | 19 EXPECT_TRUE(g_browser_process->local_state()->FindPreference( |
16 prefs::kShouldShowFirstRunBubble)); | 20 prefs::kShouldShowFirstRunBubble)); |
17 EXPECT_TRUE(first_run::SetShowFirstRunBubblePref(true)); | 21 EXPECT_TRUE(first_run::SetShowFirstRunBubblePref(true)); |
18 ASSERT_TRUE(g_browser_process->local_state()->FindPreference( | 22 ASSERT_TRUE(g_browser_process->local_state()->FindPreference( |
19 prefs::kShouldShowFirstRunBubble)); | 23 prefs::kShouldShowFirstRunBubble)); |
(...skipping 10 matching lines...) Expand all Loading... |
30 | 34 |
31 IN_PROC_BROWSER_TEST_F(FirstRunBrowserTest, SetShowWelcomePagePref) { | 35 IN_PROC_BROWSER_TEST_F(FirstRunBrowserTest, SetShowWelcomePagePref) { |
32 EXPECT_FALSE(g_browser_process->local_state()->FindPreference( | 36 EXPECT_FALSE(g_browser_process->local_state()->FindPreference( |
33 prefs::kShouldShowWelcomePage)); | 37 prefs::kShouldShowWelcomePage)); |
34 EXPECT_TRUE(first_run::SetShowWelcomePagePref()); | 38 EXPECT_TRUE(first_run::SetShowWelcomePagePref()); |
35 ASSERT_TRUE(g_browser_process->local_state()->FindPreference( | 39 ASSERT_TRUE(g_browser_process->local_state()->FindPreference( |
36 prefs::kShouldShowWelcomePage)); | 40 prefs::kShouldShowWelcomePage)); |
37 EXPECT_TRUE(g_browser_process->local_state()->GetBoolean( | 41 EXPECT_TRUE(g_browser_process->local_state()->GetBoolean( |
38 prefs::kShouldShowWelcomePage)); | 42 prefs::kShouldShowWelcomePage)); |
39 } | 43 } |
| 44 |
| 45 namespace { |
| 46 class FirstRunIntegrationBrowserTest : public InProcessBrowserTest { |
| 47 public: |
| 48 FirstRunIntegrationBrowserTest() {} |
| 49 protected: |
| 50 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 51 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 52 command_line->AppendSwitch(switches::kFirstRun); |
| 53 command_line->AppendSwitch(switches::kFirstRunForceImport); |
| 54 EXPECT_FALSE(ProfileManager::DidPerformProfileImport()); |
| 55 |
| 56 // The forked import process should run BrowserMain. |
| 57 CommandLine import_arguments((CommandLine::NoProgram())); |
| 58 import_arguments.AppendSwitch(content::kLaunchAsBrowser); |
| 59 first_run::SetExtraArgumentsForImportProcess(import_arguments); |
| 60 } |
| 61 private: |
| 62 DISALLOW_COPY_AND_ASSIGN(FirstRunIntegrationBrowserTest); |
| 63 }; |
| 64 } |
| 65 |
| 66 IN_PROC_BROWSER_TEST_F(FirstRunIntegrationBrowserTest, WaitForImport) { |
| 67 ASSERT_TRUE(ProfileManager::DidPerformProfileImport()); |
| 68 } |
OLD | NEW |