| 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 "chrome/browser/gtk/options/cookies_view.h" | 5 #include "chrome/browser/gtk/options/cookies_view.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include <gtk/gtk.h> | 10 #include <gtk/gtk.h> |
| 11 | 11 |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "chrome/browser/cookies_table_model.h" | 13 #include "chrome/browser/cookies_table_model.h" |
| 14 #include "chrome/test/testing_profile.h" | 14 #include "chrome/test/testing_profile.h" |
| 15 #include "net/url_request/url_request_context.h" | 15 #include "net/url_request/url_request_context.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class TestURLRequestContext : public URLRequestContext { | 20 class TestURLRequestContext : public URLRequestContext { |
| 21 public: | 21 public: |
| 22 TestURLRequestContext() { | 22 TestURLRequestContext() { |
| 23 cookie_store_ = new net::CookieMonster(); | 23 cookie_store_ = new net::CookieMonster(); |
| 24 } | 24 } |
| 25 virtual ~TestURLRequestContext() { | |
| 26 delete cookie_store_; | |
| 27 } | |
| 28 }; | 25 }; |
| 29 | 26 |
| 30 class CookieTestingProfile : public TestingProfile { | 27 class CookieTestingProfile : public TestingProfile { |
| 31 public: | 28 public: |
| 32 virtual URLRequestContext* GetRequestContext() { | 29 virtual URLRequestContext* GetRequestContext() { |
| 33 if (!url_request_context_.get()) | 30 if (!url_request_context_.get()) |
| 34 url_request_context_ = new TestURLRequestContext; | 31 url_request_context_ = new TestURLRequestContext; |
| 35 return url_request_context_.get(); | 32 return url_request_context_.get(); |
| 36 } | 33 } |
| 37 virtual ~CookieTestingProfile() {} | 34 virtual ~CookieTestingProfile() {} |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); | 462 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); |
| 466 | 463 |
| 467 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); | 464 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); |
| 468 | 465 |
| 469 EXPECT_STREQ("X,E,A", GetDisplayedCookies(cookies_view).c_str()); | 466 EXPECT_STREQ("X,E,A", GetDisplayedCookies(cookies_view).c_str()); |
| 470 EXPECT_STREQ("A,E,X", GetMonsterCookies(monster).c_str()); | 467 EXPECT_STREQ("A,E,X", GetMonsterCookies(monster).c_str()); |
| 471 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); | 468 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); |
| 472 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); | 469 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); |
| 473 EXPECT_EQ(0, gtk_tree_selection_count_selected_rows(cookies_view.selection_)); | 470 EXPECT_EQ(0, gtk_tree_selection_count_selected_rows(cookies_view.selection_)); |
| 474 } | 471 } |
| OLD | NEW |