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/callback.h" | 7 #include "base/callback.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 | 31 |
32 using base::ASCIIToUTF16; | 32 using base::ASCIIToUTF16; |
33 using base::Time; | 33 using base::Time; |
34 using base::TimeDelta; | 34 using base::TimeDelta; |
35 using ::testing::Return; | 35 using ::testing::Return; |
36 using ::testing::StrictMock; | 36 using ::testing::StrictMock; |
37 | 37 |
38 namespace { | 38 namespace { |
39 | 39 |
40 // TestSearchTermsData -------------------------------------------------------- | |
41 | |
42 // Simple implementation of SearchTermsData. | |
43 class TestSearchTermsData : public SearchTermsData { | |
44 public: | |
45 explicit TestSearchTermsData(const char* google_base_url); | |
46 | |
47 virtual std::string GoogleBaseURLValue() const OVERRIDE; | |
48 | |
49 private: | |
50 std::string google_base_url_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(TestSearchTermsData); | |
53 }; | |
54 | |
55 TestSearchTermsData::TestSearchTermsData(const char* google_base_url) | |
56 : google_base_url_(google_base_url) { | |
57 } | |
58 | |
59 std::string TestSearchTermsData::GoogleBaseURLValue() const { | |
60 return google_base_url_; | |
61 } | |
62 | |
63 | |
64 // QueryHistoryCallbackImpl --------------------------------------------------- | 40 // QueryHistoryCallbackImpl --------------------------------------------------- |
65 | 41 |
66 struct QueryHistoryCallbackImpl { | 42 struct QueryHistoryCallbackImpl { |
67 QueryHistoryCallbackImpl() : success(false) {} | 43 QueryHistoryCallbackImpl() : success(false) {} |
68 | 44 |
69 void Callback(bool success, | 45 void Callback(bool success, |
70 const history::URLRow& row, | 46 const history::URLRow& row, |
71 const history::VisitVector& visits) { | 47 const history::VisitVector& visits) { |
72 this->success = success; | 48 this->success = success; |
73 if (success) { | 49 if (success) { |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1511 scoped_ptr<TemplateURL::AssociatedExtensionInfo> extension_info( | 1487 scoped_ptr<TemplateURL::AssociatedExtensionInfo> extension_info( |
1512 new TemplateURL::AssociatedExtensionInfo( | 1488 new TemplateURL::AssociatedExtensionInfo( |
1513 TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); | 1489 TemplateURL::NORMAL_CONTROLLED_BY_EXTENSION, "ext1")); |
1514 extension_info->wants_to_be_default_engine = true; | 1490 extension_info->wants_to_be_default_engine = true; |
1515 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); | 1491 model()->AddExtensionControlledTURL(ext_dse, extension_info.Pass()); |
1516 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); | 1492 EXPECT_EQ(ext_dse, model()->GetTemplateURLForKeyword(ASCIIToUTF16("ext1"))); |
1517 EXPECT_TRUE(model()->is_default_search_managed()); | 1493 EXPECT_TRUE(model()->is_default_search_managed()); |
1518 actual_managed_default = model()->GetDefaultSearchProvider(); | 1494 actual_managed_default = model()->GetDefaultSearchProvider(); |
1519 ExpectSimilar(expected_managed_default.get(), actual_managed_default); | 1495 ExpectSimilar(expected_managed_default.get(), actual_managed_default); |
1520 } | 1496 } |
OLD | NEW |