| 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> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 scoped_refptr<URLRequestContextGetter> url_request_context_getter_; | 57 scoped_refptr<URLRequestContextGetter> url_request_context_getter_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 class CookiesViewTest : public testing::Test { | 62 class CookiesViewTest : public testing::Test { |
| 63 public: | 63 public: |
| 64 CookiesViewTest() : io_thread_(ChromeThread::IO, &message_loop_) { |
| 65 } |
| 66 |
| 67 virtual ~CookiesViewTest() { |
| 68 } |
| 69 |
| 64 virtual void SetUp() { | 70 virtual void SetUp() { |
| 65 profile_.reset(new CookieTestingProfile()); | 71 profile_.reset(new CookieTestingProfile()); |
| 66 } | 72 } |
| 67 | 73 |
| 68 void CheckDetailsSensitivity(gboolean expected, | 74 void CheckDetailsSensitivity(gboolean expected, |
| 69 const CookiesView& cookies_view) { | 75 const CookiesView& cookies_view) { |
| 70 EXPECT_EQ(expected, | 76 EXPECT_EQ(expected, |
| 71 GTK_WIDGET_SENSITIVE(cookies_view.cookie_name_entry_)); | 77 GTK_WIDGET_SENSITIVE(cookies_view.cookie_name_entry_)); |
| 72 EXPECT_EQ(expected, | 78 EXPECT_EQ(expected, |
| 73 GTK_WIDGET_SENSITIVE(cookies_view.cookie_content_entry_)); | 79 GTK_WIDGET_SENSITIVE(cookies_view.cookie_content_entry_)); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 &iter); | 152 &iter); |
| 147 if (path_str) { | 153 if (path_str) { |
| 148 result = path_str; | 154 result = path_str; |
| 149 g_free(path_str); | 155 g_free(path_str); |
| 150 } | 156 } |
| 151 } | 157 } |
| 152 return result; | 158 return result; |
| 153 } | 159 } |
| 154 | 160 |
| 155 protected: | 161 protected: |
| 156 MessageLoopForUI message_loop_; | 162 MessageLoop message_loop_; |
| 163 ChromeThread io_thread_; |
| 164 |
| 157 scoped_ptr<CookieTestingProfile> profile_; | 165 scoped_ptr<CookieTestingProfile> profile_; |
| 158 }; | 166 }; |
| 159 | 167 |
| 160 TEST_F(CookiesViewTest, Empty) { | 168 TEST_F(CookiesViewTest, Empty) { |
| 161 CookiesView cookies_view(profile_.get()); | 169 CookiesView cookies_view(profile_.get()); |
| 162 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); | 170 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); |
| 163 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); | 171 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); |
| 164 CheckDetailsSensitivity(FALSE, cookies_view); | 172 CheckDetailsSensitivity(FALSE, cookies_view); |
| 165 EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str()); | 173 EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str()); |
| 166 } | 174 } |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); | 456 EXPECT_EQ(TRUE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); |
| 449 | 457 |
| 450 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); | 458 gtk_button_clicked(GTK_BUTTON(cookies_view.remove_button_)); |
| 451 | 459 |
| 452 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); | 460 EXPECT_STREQ("", GetMonsterCookies(monster).c_str()); |
| 453 EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str()); | 461 EXPECT_STREQ("", GetDisplayedCookies(cookies_view).c_str()); |
| 454 | 462 |
| 455 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); | 463 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_all_button_)); |
| 456 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); | 464 EXPECT_EQ(FALSE, GTK_WIDGET_SENSITIVE(cookies_view.remove_button_)); |
| 457 } | 465 } |
| OLD | NEW |