| OLD | NEW |
| 1 // Copyright (c) 2010 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 "chrome/browser/notifications/notification_exceptions_table_model.h" | 5 #include "chrome/browser/notifications/notification_exceptions_table_model.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 8 #include "chrome/test/testing_profile.h" | 9 #include "chrome/test/testing_profile.h" |
| 9 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
| 10 #include "content/browser/renderer_host/test_render_view_host.h" | 11 #include "content/browser/renderer_host/test_render_view_host.h" |
| 11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 | 15 |
| 15 class NotificationExceptionsTableModelTest : public RenderViewHostTestHarness { | 16 class NotificationExceptionsTableModelTest : public RenderViewHostTestHarness { |
| 16 public: | 17 public: |
| 17 NotificationExceptionsTableModelTest() | 18 NotificationExceptionsTableModelTest() |
| 18 : ui_thread_(BrowserThread::UI, MessageLoop::current()) { | 19 : ui_thread_(BrowserThread::UI, MessageLoop::current()) { |
| 19 } | 20 } |
| 20 | 21 |
| 21 virtual ~NotificationExceptionsTableModelTest() { | 22 virtual ~NotificationExceptionsTableModelTest() { |
| 22 } | 23 } |
| 23 | 24 |
| 24 virtual void SetUp() { | 25 virtual void SetUp() { |
| 25 RenderViewHostTestHarness::SetUp(); | 26 RenderViewHostTestHarness::SetUp(); |
| 26 service_ = profile()->GetDesktopNotificationService(); | 27 service_ = DesktopNotificationServiceFactory::GetForProfile(profile()); |
| 27 ResetModel(); | 28 ResetModel(); |
| 28 } | 29 } |
| 29 | 30 |
| 30 virtual void TearDown() { | 31 virtual void TearDown() { |
| 31 model_.reset(NULL); | 32 model_.reset(NULL); |
| 32 RenderViewHostTestHarness::TearDown(); | 33 RenderViewHostTestHarness::TearDown(); |
| 33 } | 34 } |
| 34 | 35 |
| 35 virtual void ResetModel() { | 36 virtual void ResetModel() { |
| 36 model_.reset(new NotificationExceptionsTableModel(service_)); | 37 model_.reset(new NotificationExceptionsTableModel(service_)); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 RemoveRowsTableModel::Rows rows; | 119 RemoveRowsTableModel::Rows rows; |
| 119 rows.insert(0); | 120 rows.insert(0); |
| 120 rows.insert(1); | 121 rows.insert(1); |
| 121 rows.insert(2); | 122 rows.insert(2); |
| 122 model_->RemoveRows(rows); | 123 model_->RemoveRows(rows); |
| 123 } | 124 } |
| 124 EXPECT_EQ(0, model_->RowCount()); | 125 EXPECT_EQ(0, model_->RowCount()); |
| 125 EXPECT_EQ(0u, service_->GetAllowedOrigins().size()); | 126 EXPECT_EQ(0u, service_->GetAllowedOrigins().size()); |
| 126 EXPECT_EQ(0u, service_->GetBlockedOrigins().size()); | 127 EXPECT_EQ(0u, service_->GetBlockedOrigins().size()); |
| 127 } | 128 } |
| OLD | NEW |