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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/search_engines/template_url_service_factory_test_util.h
" | 10 #include "chrome/browser/search_engines/template_url_service_factory_test_util.h
" |
(...skipping 30 matching lines...) Expand all Loading... |
41 explicit KeywordEditorControllerTest(bool simulate_load_failure) | 41 explicit KeywordEditorControllerTest(bool simulate_load_failure) |
42 : util_(&profile_), | 42 : util_(&profile_), |
43 simulate_load_failure_(simulate_load_failure), | 43 simulate_load_failure_(simulate_load_failure), |
44 model_changed_count_(0), | 44 model_changed_count_(0), |
45 items_changed_count_(0), | 45 items_changed_count_(0), |
46 added_count_(0), | 46 added_count_(0), |
47 removed_count_(0) {} | 47 removed_count_(0) {} |
48 | 48 |
49 void SetUp() override { | 49 void SetUp() override { |
50 if (simulate_load_failure_) | 50 if (simulate_load_failure_) |
51 util_.model()->OnWebDataServiceRequestDone(0, NULL); | 51 util_.model()->OnWebDataServiceRequestDone(0, nullptr); |
52 else | 52 else |
53 util_.VerifyLoad(); | 53 util_.VerifyLoad(); |
54 | 54 |
55 controller_.reset(new KeywordEditorController(&profile_)); | 55 controller_.reset(new KeywordEditorController(&profile_)); |
56 controller_->table_model()->SetObserver(this); | 56 controller_->table_model()->SetObserver(this); |
57 } | 57 } |
58 | 58 |
59 void TearDown() override { controller_.reset(); } | 59 void TearDown() override { controller_.reset(); } |
60 | 60 |
61 void OnModelChanged() override { model_changed_count_++; } | 61 void OnModelChanged() override { model_changed_count_++; } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 data.SetKeyword(ASCIIToUTF16("a")); | 247 data.SetKeyword(ASCIIToUTF16("a")); |
248 TemplateURL* turl = util()->model()->Add(base::MakeUnique<TemplateURL>(data)); | 248 TemplateURL* turl = util()->model()->Add(base::MakeUnique<TemplateURL>(data)); |
249 | 249 |
250 // Table model should have updated. | 250 // Table model should have updated. |
251 VerifyChangeCount(1, 0, 0, 0); | 251 VerifyChangeCount(1, 0, 0, 0); |
252 | 252 |
253 // And should contain the newly added TemplateURL. | 253 // And should contain the newly added TemplateURL. |
254 ASSERT_EQ(original_row_count + 1, table_model()->RowCount()); | 254 ASSERT_EQ(original_row_count + 1, table_model()->RowCount()); |
255 ASSERT_GE(table_model()->IndexOfTemplateURL(turl), 0); | 255 ASSERT_GE(table_model()->IndexOfTemplateURL(turl), 0); |
256 } | 256 } |
OLD | NEW |