| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/sync/profile_signin_confirmation_helper.h" | 5 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 13 #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" | 14 #include "content/public/test/test_launcher.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 16 |
| 17 class ProfileSigninConfirmationHelperBrowserTest : public InProcessBrowserTest { | 17 class ProfileSigninConfirmationHelperBrowserTest : public InProcessBrowserTest { |
| 18 public: | 18 public: |
| 19 ProfileSigninConfirmationHelperBrowserTest() {} | 19 ProfileSigninConfirmationHelperBrowserTest() {} |
| 20 | 20 |
| 21 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 21 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 22 // Force the first-run flow to trigger autoimport. | 22 // Force the first-run flow to trigger autoimport. |
| 23 InProcessBrowserTest::SetUpCommandLine(command_line); | 23 InProcessBrowserTest::SetUpCommandLine(command_line); |
| 24 command_line->AppendSwitch(switches::kForceFirstRun); | 24 command_line->AppendSwitch(switches::kForceFirstRun); |
| 25 | |
| 26 // The forked import process should run BrowserMain. | |
| 27 CommandLine import_arguments((CommandLine::NoProgram())); | |
| 28 import_arguments.AppendSwitch(content::kLaunchAsBrowser); | |
| 29 first_run::SetExtraArgumentsForImportProcess(import_arguments); | |
| 30 } | 25 } |
| 31 | 26 |
| 32 private: | 27 private: |
| 33 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationHelperBrowserTest); | 28 DISALLOW_COPY_AND_ASSIGN(ProfileSigninConfirmationHelperBrowserTest); |
| 34 }; | 29 }; |
| 35 | 30 |
| 36 IN_PROC_BROWSER_TEST_F(ProfileSigninConfirmationHelperBrowserTest, | 31 IN_PROC_BROWSER_TEST_F(ProfileSigninConfirmationHelperBrowserTest, |
| 37 HasNotBeenShutdown) { | 32 HasNotBeenShutdown) { |
| 38 #if !defined(OS_CHROMEOS) | 33 #if !defined(OS_CHROMEOS) |
| 39 EXPECT_TRUE(first_run::DidPerformProfileImport(NULL)); | 34 EXPECT_TRUE(first_run::auto_import_state() & first_run::AUTO_IMPORT_CALLED); |
| 40 #endif | 35 #endif |
| 41 EXPECT_FALSE(ui::HasBeenShutdown(browser()->profile())); | 36 EXPECT_FALSE(ui::HasBeenShutdown(browser()->profile())); |
| 42 } | 37 } |
| OLD | NEW |