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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/download/download_prefs.h" | 8 #include "chrome/browser/download/download_prefs.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 309 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
310 switches::kAshBrowserTests)) | 310 switches::kAshBrowserTests)) |
311 return; | 311 return; |
312 #endif | 312 #endif |
313 | 313 |
314 ASSERT_TRUE(LoadTestExtension()) << message_; | 314 ASSERT_TRUE(LoadTestExtension()) << message_; |
315 | 315 |
316 ResultCatcher catcher; | 316 ResultCatcher catcher; |
317 | 317 |
318 // Navigate to a URL on a different hostname. | 318 // Navigate to a URL on a different hostname. |
319 std::string initial_host = "www.example.com"; | 319 static const char kInitialHost[] = "www.example.com"; |
320 host_resolver()->AddRule(initial_host, "127.0.0.1"); | 320 host_resolver()->AddRule(kInitialHost, "127.0.0.1"); |
321 GURL::Replacements replacements; | 321 GURL::Replacements replacements; |
322 replacements.SetHostStr(initial_host); | 322 replacements.SetHostStr(kInitialHost); |
323 GURL initial_url = | 323 GURL initial_url = |
324 test_server_->GetURL("/index.html").ReplaceComponents(replacements); | 324 test_server_->GetURL("/index.html").ReplaceComponents(replacements); |
325 ui_test_utils::NavigateToURL(browser(), initial_url); | 325 ui_test_utils::NavigateToURL(browser(), initial_url); |
326 | 326 |
327 // Now navigate to the doc file; the extension should pick it up normally. | 327 // Now navigate to the doc file; the extension should pick it up normally. |
328 ui_test_utils::NavigateToURL(browser(), | 328 ui_test_utils::NavigateToURL(browser(), |
329 test_server_->GetURL("/doc_path.doc")); | 329 test_server_->GetURL("/doc_path.doc")); |
330 | 330 |
331 // Wait for the response from the test server. | 331 // Wait for the response from the test server. |
332 base::MessageLoop::current()->RunUntilIdle(); | 332 base::MessageLoop::current()->RunUntilIdle(); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 base::MessageLoop::current()->RunUntilIdle(); | 480 base::MessageLoop::current()->RunUntilIdle(); |
481 EXPECT_TRUE(catcher.GetNextResult()); | 481 EXPECT_TRUE(catcher.GetNextResult()); |
482 | 482 |
483 ui_test_utils::NavigateToURL(browser(), | 483 ui_test_utils::NavigateToURL(browser(), |
484 test_server_->GetURL("/abort.rtf")); | 484 test_server_->GetURL("/abort.rtf")); |
485 base::MessageLoop::current()->RunUntilIdle(); | 485 base::MessageLoop::current()->RunUntilIdle(); |
486 EXPECT_TRUE(catcher.GetNextResult()); | 486 EXPECT_TRUE(catcher.GetNextResult()); |
487 } | 487 } |
488 | 488 |
489 } // namespace | 489 } // namespace |
OLD | NEW |