| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/command_line.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/first_run/first_run.h" | 10 #include "chrome/browser/first_run/first_run.h" |
| 12 #include "chrome/browser/prefs/pref_service.h" | |
| 13 #include "chrome/browser/prefs/session_startup_pref.h" | 11 #include "chrome/browser/prefs/session_startup_pref.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/browser_init.h" | 14 #include "chrome/browser/ui/browser_init.h" |
| 17 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 18 #include "chrome/browser/ui/browser_window.h" | 16 #include "chrome/browser/ui/browser_window.h" |
| 19 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/pref_names.h" | |
| 21 #include "chrome/test/base/in_process_browser_test.h" | 18 #include "chrome/test/base/in_process_browser_test.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 22 |
| 26 class BrowserInitTest : public ExtensionBrowserTest { | 23 class BrowserInitTest : public ExtensionBrowserTest { |
| 27 protected: | 24 protected: |
| 28 virtual void SetUpCommandLine(CommandLine* command_line) { | 25 virtual void SetUpCommandLine(CommandLine* command_line) { |
| 29 ExtensionBrowserTest::SetUpCommandLine(command_line); | 26 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 30 command_line->AppendSwitch(switches::kEnablePanels); | 27 command_line->AppendSwitch(switches::kEnablePanels); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 302 |
| 306 // Expect an app panel. | 303 // Expect an app panel. |
| 307 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app()); | 304 EXPECT_TRUE(new_browser->is_type_panel() && new_browser->is_app()); |
| 308 | 305 |
| 309 // The new browser's app_name should include the app's ID. | 306 // The new browser's app_name should include the app's ID. |
| 310 EXPECT_NE( | 307 EXPECT_NE( |
| 311 new_browser->app_name_.find(extension_app->id()), | 308 new_browser->app_name_.find(extension_app->id()), |
| 312 std::string::npos) << new_browser->app_name_; | 309 std::string::npos) << new_browser->app_name_; |
| 313 } | 310 } |
| 314 | 311 |
| 315 IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterRestart) { | |
| 316 // Tests that BrowserInit::WasRestarted reads and resets the preference | |
| 317 // kWasRestarted correctly. | |
| 318 PrefService* pref_service = g_browser_process->local_state(); | |
| 319 pref_service->SetBoolean(prefs::kWasRestarted, true); | |
| 320 EXPECT_TRUE(BrowserInit::WasRestarted()); | |
| 321 EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted)); | |
| 322 EXPECT_TRUE(BrowserInit::WasRestarted()); | |
| 323 } | |
| 324 | |
| 325 IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterNormalStart) { | |
| 326 // Tests that BrowserInit::WasRestarted reads and resets the preference | |
| 327 // kWasRestarted correctly. | |
| 328 PrefService* pref_service = g_browser_process->local_state(); | |
| 329 pref_service->SetBoolean(prefs::kWasRestarted, false); | |
| 330 EXPECT_FALSE(BrowserInit::WasRestarted()); | |
| 331 EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted)); | |
| 332 EXPECT_FALSE(BrowserInit::WasRestarted()); | |
| 333 } | |
| 334 | |
| 335 #endif // !defined(OS_MACOSX) | 312 #endif // !defined(OS_MACOSX) |
| OLD | NEW |