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/autocomplete/network_action_predictor.h" | 5 #include "chrome/browser/autocomplete/network_action_predictor.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 class NetworkActionPredictorTest : public testing::Test { | 79 class NetworkActionPredictorTest : public testing::Test { |
80 public: | 80 public: |
81 NetworkActionPredictorTest() | 81 NetworkActionPredictorTest() |
82 : loop_(MessageLoop::TYPE_DEFAULT), | 82 : loop_(MessageLoop::TYPE_DEFAULT), |
83 ui_thread_(BrowserThread::UI, &loop_), | 83 ui_thread_(BrowserThread::UI, &loop_), |
84 db_thread_(BrowserThread::DB, &loop_), | 84 db_thread_(BrowserThread::DB, &loop_), |
85 file_thread_(BrowserThread::FILE, &loop_), | 85 file_thread_(BrowserThread::FILE, &loop_), |
86 predictor_(new NetworkActionPredictor(&profile_)) { | 86 predictor_(new NetworkActionPredictor(&profile_)) { |
87 } | 87 } |
88 | 88 |
89 virtual ~NetworkActionPredictorTest() { | |
dominich
2011/12/12 18:25:01
I'm not sure, but I think calling this in TearDown
Elliot Glaysher
2011/12/12 18:43:47
Done.
| |
90 predictor_->Shutdown(); | |
91 } | |
92 | |
89 void SetUp() { | 93 void SetUp() { |
90 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 94 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
91 switches::kPrerenderFromOmnibox, | 95 switches::kPrerenderFromOmnibox, |
92 switches::kPrerenderFromOmniboxSwitchValueEnabled); | 96 switches::kPrerenderFromOmniboxSwitchValueEnabled); |
93 | 97 |
94 ASSERT_TRUE(prerender::GetOmniboxHeuristicToUse() == | 98 ASSERT_TRUE(prerender::GetOmniboxHeuristicToUse() == |
95 prerender::OMNIBOX_HEURISTIC_EXACT) | 99 prerender::OMNIBOX_HEURISTIC_EXACT) |
96 << "The heuristic has changed so the expectations need to be updated."; | 100 << "The heuristic has changed so the expectations need to be updated."; |
97 profile_.CreateHistoryService(true, false); | 101 profile_.CreateHistoryService(true, false); |
98 profile_.BlockUntilHistoryProcessesPendingRequests(); | 102 profile_.BlockUntilHistoryProcessesPendingRequests(); |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 (test_url_db[i].expected_action == | 364 (test_url_db[i].expected_action == |
361 NetworkActionPredictor::ACTION_PRERENDER) ? | 365 NetworkActionPredictor::ACTION_PRERENDER) ? |
362 NetworkActionPredictor::ACTION_PRECONNECT : | 366 NetworkActionPredictor::ACTION_PRECONNECT : |
363 test_url_db[i].expected_action; | 367 test_url_db[i].expected_action; |
364 | 368 |
365 EXPECT_EQ(expected, | 369 EXPECT_EQ(expected, |
366 predictor()->RecommendAction(test_url_db[i].user_text, match)) | 370 predictor()->RecommendAction(test_url_db[i].user_text, match)) |
367 << "Unexpected action for " << match.destination_url; | 371 << "Unexpected action for " << match.destination_url; |
368 } | 372 } |
369 } | 373 } |
OLD | NEW |