| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string16.h" | 5 #include "base/string16.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/search_engines/template_url.h" | 8 #include "chrome/browser/search_engines/template_url.h" |
| 9 #include "chrome/browser/search_engines/template_url_model.h" | 9 #include "chrome/browser/search_engines/template_url_model.h" |
| 10 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" | 10 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 ClearChangeCount(); | 107 ClearChangeCount(); |
| 108 | 108 |
| 109 // If init is called twice, make sure that the controller is destroyed before | 109 // If init is called twice, make sure that the controller is destroyed before |
| 110 // the profile is. | 110 // the profile is. |
| 111 controller_.reset(); | 111 controller_.reset(); |
| 112 profile_.reset(new TestingProfile()); | 112 profile_.reset(new TestingProfile()); |
| 113 profile_->CreateTemplateURLModel(); | 113 profile_->CreateTemplateURLModel(); |
| 114 | 114 |
| 115 model_ = profile_->GetTemplateURLModel(); | 115 model_ = profile_->GetTemplateURLModel(); |
| 116 if (simulate_load_failure) | 116 if (simulate_load_failure) |
| 117 model_->OnWebDataServiceRequestDone(NULL, NULL); | 117 model_->OnWebDataServiceRequestDone(0, NULL); |
| 118 | 118 |
| 119 controller_.reset(new KeywordEditorController(profile_.get())); | 119 controller_.reset(new KeywordEditorController(profile_.get())); |
| 120 controller_->table_model()->SetObserver(this); | 120 controller_->table_model()->SetObserver(this); |
| 121 } | 121 } |
| 122 | 122 |
| 123 // Tests adding a TemplateURL. | 123 // Tests adding a TemplateURL. |
| 124 TEST_F(KeywordEditorControllerTest, Add) { | 124 TEST_F(KeywordEditorControllerTest, Add) { |
| 125 controller_->AddTemplateURL(kA, kB, "http://c"); | 125 controller_->AddTemplateURL(kA, kB, "http://c"); |
| 126 | 126 |
| 127 // Verify the observer was notified. | 127 // Verify the observer was notified. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 turl->set_short_name(ASCIIToUTF16("b")); | 249 turl->set_short_name(ASCIIToUTF16("b")); |
| 250 model_->Add(turl); | 250 model_->Add(turl); |
| 251 | 251 |
| 252 // Table model should have updated. | 252 // Table model should have updated. |
| 253 VerifyChangeCount(1, 0, 0, 0); | 253 VerifyChangeCount(1, 0, 0, 0); |
| 254 | 254 |
| 255 // And should contain the newly added TemplateURL. | 255 // And should contain the newly added TemplateURL. |
| 256 ASSERT_EQ(1, table_model()->RowCount()); | 256 ASSERT_EQ(1, table_model()->RowCount()); |
| 257 ASSERT_EQ(0, table_model()->IndexOfTemplateURL(turl)); | 257 ASSERT_EQ(0, table_model()->IndexOfTemplateURL(turl)); |
| 258 } | 258 } |
| OLD | NEW |