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