| OLD | NEW |
| 1 // Copyright (c) 2011 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/gtk/keyword_editor_view.h" | 5 #include "chrome/browser/gtk/keyword_editor_view.h" |
| 6 | 6 |
| 7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 virtual void SetUp() { | 24 virtual void SetUp() { |
| 25 profile_.reset(new TestingProfile()); | 25 profile_.reset(new TestingProfile()); |
| 26 profile_->CreateTemplateURLModel(); | 26 profile_->CreateTemplateURLModel(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 TemplateURL* AddToModel(const std::string& name, | 29 TemplateURL* AddToModel(const std::string& name, |
| 30 const std::string& keyword, | 30 const std::string& keyword, |
| 31 bool make_default) { | 31 bool make_default) { |
| 32 TemplateURL* template_url = new TemplateURL(); | 32 TemplateURL* template_url = new TemplateURL(); |
| 33 template_url->set_short_name(UTF8ToUTF16(name)); | 33 template_url->set_short_name(UTF8ToWide(name)); |
| 34 template_url->set_keyword(UTF8ToUTF16(keyword)); | 34 template_url->set_keyword(UTF8ToWide(keyword)); |
| 35 template_url->SetURL("http://example.com/{searchTerms}", 0, 0); | 35 template_url->SetURL("http://example.com/{searchTerms}", 0, 0); |
| 36 profile_->GetTemplateURLModel()->Add(template_url); | 36 profile_->GetTemplateURLModel()->Add(template_url); |
| 37 if (make_default) | 37 if (make_default) |
| 38 profile_->GetTemplateURLModel()->SetDefaultSearchProvider(template_url); | 38 profile_->GetTemplateURLModel()->SetDefaultSearchProvider(template_url); |
| 39 return template_url; | 39 return template_url; |
| 40 } | 40 } |
| 41 | 41 |
| 42 int GetSelectedRowNum(const KeywordEditorView& editor) { | 42 int GetSelectedRowNum(const KeywordEditorView& editor) { |
| 43 GtkTreeIter iter; | 43 GtkTreeIter iter; |
| 44 if (!gtk_tree_selection_get_selected(editor.selection_, NULL, &iter)) | 44 if (!gtk_tree_selection_get_selected(editor.selection_, NULL, &iter)) |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 editor.OnEditedKeyword(d, ASCIIToUTF16("DD"), ASCIIToUTF16("d"), | 262 editor.OnEditedKeyword(d, ASCIIToUTF16("DD"), ASCIIToUTF16("d"), |
| 263 "example.com"); | 263 "example.com"); |
| 264 EXPECT_STREQ("!,_,AA,BBB,_,@,_,C,DD", | 264 EXPECT_STREQ("!,_,AA,BBB,_,@,_,C,DD", |
| 265 GetDisplayedEngines(editor).c_str()); | 265 GetDisplayedEngines(editor).c_str()); |
| 266 | 266 |
| 267 editor.OnEditedKeyword(c, ASCIIToUTF16("CC"), ASCIIToUTF16("cc"), | 267 editor.OnEditedKeyword(c, ASCIIToUTF16("CC"), ASCIIToUTF16("cc"), |
| 268 "example.com"); | 268 "example.com"); |
| 269 EXPECT_STREQ("!,_,AA,BBB,_,@,_,CC,DD", | 269 EXPECT_STREQ("!,_,AA,BBB,_,@,_,CC,DD", |
| 270 GetDisplayedEngines(editor).c_str()); | 270 GetDisplayedEngines(editor).c_str()); |
| 271 } | 271 } |
| OLD | NEW |