| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 "}], 'test_rule');\n"; | 223 "}], 'test_rule');\n"; |
| 224 | 224 |
| 225 EXPECT_EQ("test_rule", ExecuteScriptInBackgroundPage( | 225 EXPECT_EQ("test_rule", ExecuteScriptInBackgroundPage( |
| 226 extension->id(), | 226 extension->id(), |
| 227 base::StringPrintf(kSetIsBookmarkedRule, | 227 base::StringPrintf(kSetIsBookmarkedRule, |
| 228 match_is_bookmarked ? "true" : "false"))); | 228 match_is_bookmarked ? "true" : "false"))); |
| 229 EXPECT_EQ(!match_is_bookmarked, page_action->GetIsVisible(tab_id)); | 229 EXPECT_EQ(!match_is_bookmarked, page_action->GetIsVisible(tab_id)); |
| 230 | 230 |
| 231 // Check rule evaluation on add/remove bookmark. | 231 // Check rule evaluation on add/remove bookmark. |
| 232 bookmarks::BookmarkModel* bookmark_model = | 232 bookmarks::BookmarkModel* bookmark_model = |
| 233 BookmarkModelFactory::GetForProfile(browser()->profile()); | 233 BookmarkModelFactory::GetForBrowserContext(browser()->profile()); |
| 234 const bookmarks::BookmarkNode* node = | 234 const bookmarks::BookmarkNode* node = |
| 235 bookmark_model->AddURL(bookmark_model->other_node(), 0, | 235 bookmark_model->AddURL(bookmark_model->other_node(), 0, |
| 236 base::ASCIIToUTF16("title"), | 236 base::ASCIIToUTF16("title"), |
| 237 GURL("http://test1/")); | 237 GURL("http://test1/")); |
| 238 EXPECT_EQ(match_is_bookmarked, page_action->GetIsVisible(tab_id)); | 238 EXPECT_EQ(match_is_bookmarked, page_action->GetIsVisible(tab_id)); |
| 239 | 239 |
| 240 bookmark_model->Remove(node); | 240 bookmark_model->Remove(node); |
| 241 EXPECT_EQ(!match_is_bookmarked, page_action->GetIsVisible(tab_id)); | 241 EXPECT_EQ(!match_is_bookmarked, page_action->GetIsVisible(tab_id)); |
| 242 | 242 |
| 243 // Check rule evaluation on navigate to bookmarked and non-bookmarked URL. | 243 // Check rule evaluation on navigate to bookmarked and non-bookmarked URL. |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 // action interfaces, add a test that checks that a navigation always evaluates | 983 // action interfaces, add a test that checks that a navigation always evaluates |
| 984 // consistent URL state for all conditions. i.e.: if condition1 evaluates to | 984 // consistent URL state for all conditions. i.e.: if condition1 evaluates to |
| 985 // false on url0 and true on url1, and condition2 evaluates to true on url0 and | 985 // false on url0 and true on url1, and condition2 evaluates to true on url0 and |
| 986 // false on url1, navigate from url0 to url1 and validate that no action is | 986 // false on url1, navigate from url0 to url1 and validate that no action is |
| 987 // triggered. Do the same when navigating back to url0. This kind of test is | 987 // triggered. Do the same when navigating back to url0. This kind of test is |
| 988 // unfortunately not feasible with the current implementation and the existing | 988 // unfortunately not feasible with the current implementation and the existing |
| 989 // supported conditions and actions. | 989 // supported conditions and actions. |
| 990 | 990 |
| 991 } // namespace | 991 } // namespace |
| 992 } // namespace extensions | 992 } // namespace extensions |
| OLD | NEW |