| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "app/table_model_observer.h" |
| 5 #include "chrome/browser/profile.h" | 6 #include "chrome/browser/profile.h" |
| 6 #include "chrome/browser/search_engines/template_url.h" | 7 #include "chrome/browser/search_engines/template_url.h" |
| 7 #include "chrome/browser/search_engines/template_url_model.h" | 8 #include "chrome/browser/search_engines/template_url_model.h" |
| 8 #include "chrome/browser/views/keyword_editor_view.h" | 9 #include "chrome/browser/views/keyword_editor_view.h" |
| 9 #include "chrome/test/testing_profile.h" | 10 #include "chrome/test/testing_profile.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "views/controls/table/table_model_observer.h" | |
| 12 | 12 |
| 13 // Base class for keyword editor tests. Creates a profile containing an | 13 // Base class for keyword editor tests. Creates a profile containing an |
| 14 // empty TemplateURLModel. | 14 // empty TemplateURLModel. |
| 15 class KeywordEditorViewTest : public testing::Test, | 15 class KeywordEditorViewTest : public testing::Test, |
| 16 public views::TableModelObserver { | 16 public TableModelObserver { |
| 17 public: | 17 public: |
| 18 virtual void SetUp() { | 18 virtual void SetUp() { |
| 19 model_changed_count_ = items_changed_count_ = added_count_ = | 19 model_changed_count_ = items_changed_count_ = added_count_ = |
| 20 removed_count_ = 0; | 20 removed_count_ = 0; |
| 21 | 21 |
| 22 profile_.reset(new TestingProfile()); | 22 profile_.reset(new TestingProfile()); |
| 23 profile_->CreateTemplateURLModel(); | 23 profile_->CreateTemplateURLModel(); |
| 24 | 24 |
| 25 model_ = profile_->GetTemplateURLModel(); | 25 model_ = profile_->GetTemplateURLModel(); |
| 26 | 26 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 turl->set_short_name(L"b"); | 136 turl->set_short_name(L"b"); |
| 137 model_->Add(turl); | 137 model_->Add(turl); |
| 138 | 138 |
| 139 // Table model should have updated. | 139 // Table model should have updated. |
| 140 VerifyChangeCount(1, 0, 0, 0); | 140 VerifyChangeCount(1, 0, 0, 0); |
| 141 | 141 |
| 142 // And should contain the newly added TemplateURL. | 142 // And should contain the newly added TemplateURL. |
| 143 ASSERT_EQ(1, table_model()->RowCount()); | 143 ASSERT_EQ(1, table_model()->RowCount()); |
| 144 ASSERT_EQ(0, table_model()->IndexOfTemplateURL(turl)); | 144 ASSERT_EQ(0, table_model()->IndexOfTemplateURL(turl)); |
| 145 } | 145 } |
| OLD | NEW |