| 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/message_loop.h" | |
| 6 #include "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/autocomplete/autocomplete_edit.h" | 6 #include "chrome/browser/autocomplete/autocomplete_edit.h" |
| 8 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 7 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 9 #include "chrome/test/base/testing_browser_process.h" | 8 #include "chrome/test/base/testing_browser_process.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 | 12 |
| 14 using content::WebContents; | 13 using content::WebContents; |
| 15 | 14 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 virtual TabContentsWrapper* GetTabContentsWrapper() const OVERRIDE { | 99 virtual TabContentsWrapper* GetTabContentsWrapper() const OVERRIDE { |
| 101 return NULL; | 100 return NULL; |
| 102 } | 101 } |
| 103 | 102 |
| 104 private: | 103 private: |
| 105 DISALLOW_COPY_AND_ASSIGN(TestingAutocompleteEditController); | 104 DISALLOW_COPY_AND_ASSIGN(TestingAutocompleteEditController); |
| 106 }; | 105 }; |
| 107 | 106 |
| 108 } // namespace | 107 } // namespace |
| 109 | 108 |
| 110 class AutocompleteEditTest : public ::testing::Test { | 109 class AutocompleteEditTest : public ::testing::Test {}; |
| 111 private: | |
| 112 // Needed by the blocking pool (but no need to pump it). | |
| 113 MessageLoop message_loop_; | |
| 114 }; | |
| 115 | 110 |
| 116 // Tests various permutations of AutocompleteModel::AdjustTextForCopy. | 111 // Tests various permutations of AutocompleteModel::AdjustTextForCopy. |
| 117 TEST_F(AutocompleteEditTest, AdjustTextForCopy) { | 112 TEST_F(AutocompleteEditTest, AdjustTextForCopy) { |
| 118 struct Data { | 113 struct Data { |
| 119 const char* perm_text; | 114 const char* perm_text; |
| 120 const int sel_start; | 115 const int sel_start; |
| 121 const bool is_all_selected; | 116 const bool is_all_selected; |
| 122 const char* input; | 117 const char* input; |
| 123 const char* expected_output; | 118 const char* expected_output; |
| 124 const bool write_url; | 119 const bool write_url; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 GURL url; | 167 GURL url; |
| 173 bool write_url; | 168 bool write_url; |
| 174 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, | 169 model.AdjustTextForCopy(input[i].sel_start, input[i].is_all_selected, |
| 175 &result, &url, &write_url); | 170 &result, &url, &write_url); |
| 176 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; | 171 EXPECT_EQ(ASCIIToUTF16(input[i].expected_output), result) << "@: " << i; |
| 177 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; | 172 EXPECT_EQ(input[i].write_url, write_url) << " @" << i; |
| 178 if (write_url) | 173 if (write_url) |
| 179 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; | 174 EXPECT_EQ(input[i].expected_url, url.spec()) << " @" << i; |
| 180 } | 175 } |
| 181 } | 176 } |
| OLD | NEW |