| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/test/ui/ui_test.h" | 5 #include "chrome/test/ui/ui_test.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/dom_ui/new_tab_ui.h" | 8 #include "chrome/browser/dom_ui/new_tab_ui.h" |
| 9 #include "chrome/browser/prefs/pref_value_store.h" | 9 #include "chrome/browser/prefs/pref_value_store.h" |
| 10 #include "chrome/browser/sync/signin_manager.h" | 10 #include "chrome/browser/sync/signin_manager.h" |
| 11 #include "chrome/common/json_pref_store.h" | 11 #include "chrome/common/json_pref_store.h" |
| 12 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "chrome/test/automation/browser_proxy.h" | 14 #include "chrome/test/automation/browser_proxy.h" |
| 15 #include "chrome/test/automation/tab_proxy.h" | 15 #include "chrome/test/automation/tab_proxy.h" |
| 16 #include "chrome/test/automation/window_proxy.h" | 16 #include "chrome/test/automation/window_proxy.h" |
| 17 #include "chrome/test/testing_pref_service.h" | 17 #include "chrome/test/testing_pref_service.h" |
| 18 | 18 |
| 19 class NewTabUITest : public UITest { | 19 class NewTabUITest : public UITest { |
| 20 public: | 20 public: |
| 21 NewTabUITest() { | 21 NewTabUITest() { |
| 22 dom_automation_enabled_ = true; | 22 dom_automation_enabled_ = true; |
| 23 // Set home page to the empty string so that we can set the home page using | 23 // Set home page to the empty string so that we can set the home page using |
| 24 // preferences. | 24 // preferences. |
| 25 homepage_ = ""; | 25 set_homepage(""); |
| 26 | 26 |
| 27 // Setup the DEFAULT_THEME profile (has fake history entries). | 27 // Setup the DEFAULT_THEME profile (has fake history entries). |
| 28 set_template_user_data(UITest::ComputeTypicalUserDataSource( | 28 set_template_user_data(UITest::ComputeTypicalUserDataSource( |
| 29 UITest::DEFAULT_THEME)); | 29 ProxyLauncher::DEFAULT_THEME)); |
| 30 } | 30 } |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 TEST_F(NewTabUITest, NTPHasThumbnails) { | 33 TEST_F(NewTabUITest, NTPHasThumbnails) { |
| 34 // Switch to the "new tab" tab, which should be any new tab after the | 34 // Switch to the "new tab" tab, which should be any new tab after the |
| 35 // first (the first is about:blank). | 35 // first (the first is about:blank). |
| 36 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); | 36 scoped_refptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); |
| 37 ASSERT_TRUE(window.get()); | 37 ASSERT_TRUE(window.get()); |
| 38 | 38 |
| 39 // Bring up a new tab page. | 39 // Bring up a new tab page. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion)); | 144 ASSERT_EQ(0, prefs->GetInteger(prefs::kNTPPrefVersion)); |
| 145 | 145 |
| 146 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); | 146 bool migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); |
| 147 ASSERT_TRUE(migrated); | 147 ASSERT_TRUE(migrated); |
| 148 ASSERT_EQ(NewTabUI::current_pref_version(), | 148 ASSERT_EQ(NewTabUI::current_pref_version(), |
| 149 prefs->GetInteger(prefs::kNTPPrefVersion)); | 149 prefs->GetInteger(prefs::kNTPPrefVersion)); |
| 150 | 150 |
| 151 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); | 151 migrated = NewTabUI::UpdateUserPrefsVersion(prefs.get()); |
| 152 ASSERT_FALSE(migrated); | 152 ASSERT_FALSE(migrated); |
| 153 } | 153 } |
| OLD | NEW |