Commit 4b5a5b9f authored by Rohit Agarwal's avatar Rohit Agarwal Committed by Commit Bot

Revert "Add regression tests."

This reverts commit 3fcc018a.

Reason for revert:

The original CL https://chromium-review.googlesource.com/c/chromium/src/+/1839793
is getting reverted, so we need to remove these tests.
The tests will be added again, once after the revert is made and the
necessary changes are done to address the issue mentioned in the revert
reason.

Original change's description:
> Add regression tests.
>
> Bug: 1004101
> Change-Id: I8c8d12cc4faa60b6ead3abf2ed7ca8572fbca6f7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1803921
> Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
> Reviewed-by: Florian Uunk <feuunk@chromium.org>
> Commit-Queue: Rohit Agarwal <roagarwal@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#699901}

TBR=vasilii@chromium.org,feuunk@chromium.org,roagarwal@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1004101
Change-Id: I5391451791b9455652154f7eb7cfea5232f14747
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1839794Reviewed-by: default avatarVasilii Sukhanov <vasilii@chromium.org>
Commit-Queue: Rohit Agarwal <roagarwal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#702820}
parent a9bf62bc
......@@ -6,8 +6,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/in_process_browser_test.h"
......@@ -29,87 +27,3 @@ TEST_F(ApplicationLifetimeTest, AttemptRestart) {
// ran after this one will fail.
browser_shutdown::SetTryingToQuit(false);
}
TEST_F(ApplicationLifetimeTest, AttemptRestartWithIncognitoAfterRegular) {
ASSERT_TRUE(g_browser_process);
base::CommandLine& old_cl(*base::CommandLine::ForCurrentProcess());
TestingPrefServiceSimple* testing_pref_service =
profile_manager()->local_state()->Get();
EXPECT_FALSE(testing_pref_service->GetBoolean(prefs::kWasRestarted));
// Create a new incognito browser.
TestingProfile::Builder profile_builder;
std::unique_ptr<TestingProfile> test_profile = profile_builder.Build();
Browser::CreateParams params{test_profile->GetOffTheRecordProfile(), false};
std::unique_ptr<BrowserWindow> test_window(CreateBrowserWindow());
params.window = test_window.get();
std::unique_ptr<Browser> incognito_browser(Browser::Create(params));
EXPECT_TRUE(incognito_browser);
EXPECT_TRUE(incognito_browser->profile()->IsIncognitoProfile());
BrowserList::SetLastActive(incognito_browser.get());
// When the first browser was created it was created in regular
// mode, so the command line arguments for it shouldn't have the incongito
// switch.
EXPECT_FALSE(old_cl.HasSwitch(switches::kIncognito));
// We will now attempt restart, prior to (crbug.com/999085)
// the new session after restart defaulted to the browser type
// of the last session. We now restart to the browser type of
// the user who invoked restart, which is emulated here,
// via the method BrowserList::SetLastActive().
chrome::AttemptRestart();
// Since, the last active browser was of type Incognito, we now
// expect to have the kIncognito switch added to the old_cl cmd line
// arguments, the old_cl arguments are then used to create the
// new cmd line session post restart.
EXPECT_TRUE(old_cl.HasSwitch(switches::kIncognito));
EXPECT_TRUE(testing_pref_service->GetBoolean(prefs::kWasRestarted));
// Cancel the effects of us calling chrome::AttemptRestart. Otherwise tests
// ran after this one will fail.
browser_shutdown::SetTryingToQuit(false);
// We perform the run loop before to avoid ASAN failures which access
// the Testing profile after the test is run.
base::RunLoop().RunUntilIdle();
}
TEST_F(ApplicationLifetimeTest, AttemptRestartWithRegularAfterIncognito) {
ASSERT_TRUE(g_browser_process);
base::CommandLine& old_cl(*base::CommandLine::ForCurrentProcess());
TestingPrefServiceSimple* testing_pref_service =
profile_manager()->local_state()->Get();
EXPECT_FALSE(testing_pref_service->GetBoolean(prefs::kWasRestarted));
// Create a new incognito browser.
TestingProfile::Builder profile_builder;
std::unique_ptr<TestingProfile> test_profile = profile_builder.Build();
Browser::CreateParams params{test_profile->GetOffTheRecordProfile(), false};
std::unique_ptr<BrowserWindow> test_window(CreateBrowserWindow());
params.window = test_window.get();
std::unique_ptr<Browser> incognito_browser(Browser::Create(params));
EXPECT_TRUE(incognito_browser);
EXPECT_TRUE(incognito_browser->profile()->IsIncognitoProfile());
// Since the original browser that is created in the Setup() phase
// is always a regular browser, we emulate the incognito part
// by apppending |kIncongito| switch to its command line args.
old_cl.AppendSwitch(switches::kIncognito);
// Make the regular browser last active.
BrowserList::SetLastActive(browser());
EXPECT_TRUE(old_cl.HasSwitch(switches::kIncognito));
chrome::AttemptRestart();
EXPECT_FALSE(old_cl.HasSwitch(switches::kIncognito));
EXPECT_TRUE(testing_pref_service->GetBoolean(prefs::kWasRestarted));
// Cancel the effects of us calling chrome::AttemptRestart. Otherwise tests
// ran after this one will fail.
browser_shutdown::SetTryingToQuit(false);
// We perform the run loop before to avoid ASAN failures which access
// the Testing profile after the test is run.
base::RunLoop().RunUntilIdle();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment