| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/metrics/histogram.h" | 6 #include "base/metrics/histogram.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/protector/histograms.h" | 9 #include "chrome/browser/protector/histograms.h" |
| 10 #include "chrome/browser/protector/mock_protector_service.h" | 10 #include "chrome/browser/protector/mock_protector_service.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 scoped_ptr<BaseSettingChange> change( | 476 scoped_ptr<BaseSettingChange> change( |
| 477 CreateDefaultSearchProviderChange(current_url, backup_url)); | 477 CreateDefaultSearchProviderChange(current_url, backup_url)); |
| 478 ASSERT_TRUE(change.get()); | 478 ASSERT_TRUE(change.get()); |
| 479 ASSERT_TRUE(change->Init(browser()->profile())); | 479 ASSERT_TRUE(change->Init(browser()->profile())); |
| 480 | 480 |
| 481 // Verify that backup is active. | 481 // Verify that backup is active. |
| 482 EXPECT_EQ(FindTemplateURL(http_example_info), | 482 EXPECT_EQ(FindTemplateURL(http_example_info), |
| 483 turl_service_->GetDefaultSearchProvider()); | 483 turl_service_->GetDefaultSearchProvider()); |
| 484 | 484 |
| 485 // Verify that changing search provider externally dismissed the change. | 485 // Verify that changing search provider externally dismissed the change. |
| 486 EXPECT_CALL(*mock_protector_service_, DismissChange()); | 486 EXPECT_CALL(*mock_protector_service_, DismissChange(change.get())); |
| 487 AddAndSetDefault(new_url); | 487 AddAndSetDefault(new_url); |
| 488 } | 488 } |
| 489 | 489 |
| 490 IN_PROC_BROWSER_TEST_F(DefaultSearchProviderChangeTest, | 490 IN_PROC_BROWSER_TEST_F(DefaultSearchProviderChangeTest, |
| 491 CurrentSearchProviderRemovedByUser) { | 491 CurrentSearchProviderRemovedByUser) { |
| 492 // Current search provider is removed by user while the error is active. | 492 // Current search provider is removed by user while the error is active. |
| 493 // Setup is the same as in BackupValid test case. | 493 // Setup is the same as in BackupValid test case. |
| 494 TemplateURL* backup_url = | 494 TemplateURL* backup_url = |
| 495 MakeTemplateURL(example_info, ASCIIToUTF16("a"), http_example_info); | 495 MakeTemplateURL(example_info, ASCIIToUTF16("a"), http_example_info); |
| 496 TemplateURL* current_url = | 496 TemplateURL* current_url = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 522 EXPECT_EQ(FindTemplateURL(http_example_info), | 522 EXPECT_EQ(FindTemplateURL(http_example_info), |
| 523 turl_service_->GetDefaultSearchProvider()); | 523 turl_service_->GetDefaultSearchProvider()); |
| 524 | 524 |
| 525 // Discard does nothing - backup was already active. | 525 // Discard does nothing - backup was already active. |
| 526 change->Discard(browser()); | 526 change->Discard(browser()); |
| 527 EXPECT_EQ(FindTemplateURL(http_example_info), | 527 EXPECT_EQ(FindTemplateURL(http_example_info), |
| 528 turl_service_->GetDefaultSearchProvider()); | 528 turl_service_->GetDefaultSearchProvider()); |
| 529 } | 529 } |
| 530 | 530 |
| 531 } // namespace protector | 531 } // namespace protector |
| OLD | NEW |