Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5277)

Unified Diff: chrome/browser/first_run/first_run_browsertest.cc

Issue 12094026: Skip a first-run import on Mac when there is nothing left to import. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove fragile check Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/first_run/first_run.cc ('k') | chrome/browser/first_run/first_run_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run/first_run_browsertest.cc
diff --git a/chrome/browser/first_run/first_run_browsertest.cc b/chrome/browser/first_run/first_run_browsertest.cc
index fa789ac67ce5a6c30e8dfd083f136edb76c90288..3f0e3c62ef6b1d3db1b82ad0b17e850f318b07ef 100644
--- a/chrome/browser/first_run/first_run_browsertest.cc
+++ b/chrome/browser/first_run/first_run_browsertest.cc
@@ -3,14 +3,20 @@
// found in the LICENSE file.
#include "base/command_line.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/component_loader.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
+#include "chrome/test/base/ui_test_utils.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/test/test_launcher.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -80,9 +86,58 @@ class FirstRunIntegrationBrowserTest : public InProcessBrowserTest {
private:
DISALLOW_COPY_AND_ASSIGN(FirstRunIntegrationBrowserTest);
};
+
+class FirstRunMasterPrefsBrowserTest : public FirstRunIntegrationBrowserTest {
+ public:
+ FirstRunMasterPrefsBrowserTest() {}
+
+ protected:
+ virtual void SetUp() OVERRIDE {
+ ASSERT_TRUE(file_util::CreateTemporaryFile(&prefs_file_));
+ // TODO(tapted): Make this reusable.
+ const char text[] =
+ "{\n"
+ " \"distribution\": {\n"
+ " \"import_bookmarks\": false,\n"
+ " \"import_history\": false,\n"
+ " \"import_home_page\": false,\n"
+ " \"import_search_engine\": false\n"
+ " }\n"
+ "}\n";
+ EXPECT_TRUE(file_util::WriteFile(prefs_file_, text, strlen(text)));
+ first_run::SetMasterPrefsPathForTesting(prefs_file_);
+
+ // This invokes BrowserMain, and does the import, so must be done last.
+ FirstRunIntegrationBrowserTest::SetUp();
+ }
+
+ virtual void TearDown() OVERRIDE {
+ EXPECT_TRUE(file_util::Delete(prefs_file_, false));
+ FirstRunIntegrationBrowserTest::TearDown();
+ }
+
+ private:
+ FilePath prefs_file_;
+
+ DISALLOW_COPY_AND_ASSIGN(FirstRunMasterPrefsBrowserTest);
+};
}
IN_PROC_BROWSER_TEST_F(FirstRunIntegrationBrowserTest, WaitForImport) {
ASSERT_TRUE(ProfileManager::DidPerformProfileImport());
}
+
+// Test an import with all import options disabled. This is a regression test
+// for http://crbug.com/169984 where this would cause the import process to
+// stay running, and the NTP to be loaded with no apps.
+IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsBrowserTest,
+ ImportNothingAndShowNewTabPage) {
+ ASSERT_TRUE(ProfileManager::DidPerformProfileImport());
+ ui_test_utils::NavigateToURLWithDisposition(
+ browser(), GURL(chrome::kChromeUINewTabURL), CURRENT_TAB,
+ ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
+ content::WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0);
+ EXPECT_EQ(1, tab->GetMaxPageID());
+}
+
#endif // !defined(OS_CHROMEOS)
« no previous file with comments | « chrome/browser/first_run/first_run.cc ('k') | chrome/browser/first_run/first_run_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698