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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram_base.h" | 8 #include "base/metrics/histogram_base.h" |
9 #include "base/metrics/histogram_samples.h" | 9 #include "base/metrics/histogram_samples.h" |
10 #include "base/metrics/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 InstantTestBase::Init(instant_url); | 305 InstantTestBase::Init(instant_url); |
306 } | 306 } |
307 | 307 |
308 void InstallThemeSource() { | 308 void InstallThemeSource() { |
309 ThemeSource* theme = new ThemeSource(profile()); | 309 ThemeSource* theme = new ThemeSource(profile()); |
310 content::URLDataSource::Add(profile(), theme); | 310 content::URLDataSource::Add(profile(), theme); |
311 } | 311 } |
312 | 312 |
313 void InstallThemeAndVerify(const std::string& theme_dir, | 313 void InstallThemeAndVerify(const std::string& theme_dir, |
314 const std::string& theme_name) { | 314 const std::string& theme_name) { |
315 const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_dir); | |
316 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm( | |
317 theme_path, 1, ExtensionBrowserTest::browser())); | |
318 const extensions::Extension* theme = | 315 const extensions::Extension* theme = |
319 ThemeServiceFactory::GetThemeForProfile( | 316 ThemeServiceFactory::GetThemeForProfile( |
320 ExtensionBrowserTest::browser()->profile()); | 317 ExtensionBrowserTest::browser()->profile()); |
321 ASSERT_NE(static_cast<extensions::Extension*>(NULL), theme); | 318 // If there is already a theme installed, the current theme should be |
322 ASSERT_EQ(theme->name(), theme_name); | 319 // disabled and the new one installed + enabled. |
| 320 int expected_change = theme ? 0 : 1; |
| 321 |
| 322 const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_dir); |
| 323 ASSERT_TRUE(InstallExtensionWithUIAutoConfirm( |
| 324 theme_path, expected_change, ExtensionBrowserTest::browser())); |
| 325 const extensions::Extension* new_theme = |
| 326 ThemeServiceFactory::GetThemeForProfile( |
| 327 ExtensionBrowserTest::browser()->profile()); |
| 328 ASSERT_NE(static_cast<extensions::Extension*>(NULL), new_theme); |
| 329 ASSERT_EQ(new_theme->name(), theme_name); |
323 } | 330 } |
324 | 331 |
325 private: | 332 private: |
326 DISALLOW_COPY_AND_ASSIGN(InstantPolicyTest); | 333 DISALLOW_COPY_AND_ASSIGN(InstantPolicyTest); |
327 }; | 334 }; |
328 | 335 |
329 #if defined(HTML_INSTANT_EXTENDED_POPUP) | 336 #if defined(HTML_INSTANT_EXTENDED_POPUP) |
330 | 337 |
331 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ExtendedModeIsOn) { | 338 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, ExtendedModeIsOn) { |
332 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 339 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 content::WindowedNotificationObserver observer( | 1651 content::WindowedNotificationObserver observer( |
1645 content::NOTIFICATION_LOAD_STOP, | 1652 content::NOTIFICATION_LOAD_STOP, |
1646 content::Source<content::NavigationController>( | 1653 content::Source<content::NavigationController>( |
1647 &ntp_contents->GetController())); | 1654 &ntp_contents->GetController())); |
1648 service->SetDefaultSearchProvider(template_url); | 1655 service->SetDefaultSearchProvider(template_url); |
1649 observer.Wait(); | 1656 observer.Wait(); |
1650 | 1657 |
1651 // Make sure the URL remains the same. | 1658 // Make sure the URL remains the same. |
1652 EXPECT_EQ(ntp_url, ntp_contents->GetURL()); | 1659 EXPECT_EQ(ntp_url, ntp_contents->GetURL()); |
1653 } | 1660 } |
OLD | NEW |