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