| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/banners/app_banner_data_fetcher.h" | 5 #include "chrome/browser/banners/app_banner_data_fetcher.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 protected: | 88 protected: |
| 89 void RunFetcher(const GURL& url, | 89 void RunFetcher(const GURL& url, |
| 90 const std::string& expected_non_web_platform, | 90 const std::string& expected_non_web_platform, |
| 91 ui::PageTransition transition, | 91 ui::PageTransition transition, |
| 92 bool expected_to_show) { | 92 bool expected_to_show) { |
| 93 content::WebContents* web_contents = | 93 content::WebContents* web_contents = |
| 94 browser()->tab_strip_model()->GetActiveWebContents(); | 94 browser()->tab_strip_model()->GetActiveWebContents(); |
| 95 scoped_refptr<AppBannerDataFetcherDesktop> fetcher( | 95 scoped_refptr<AppBannerDataFetcherDesktop> fetcher( |
| 96 new AppBannerDataFetcherDesktop(web_contents, | 96 new AppBannerDataFetcherDesktop(web_contents, |
| 97 weak_factory_.GetWeakPtr(), 128)); | 97 weak_factory_.GetWeakPtr(), |
| 98 128, 128)); |
| 98 | 99 |
| 99 base::RunLoop run_loop; | 100 base::RunLoop run_loop; |
| 100 quit_closure_ = run_loop.QuitClosure(); | 101 quit_closure_ = run_loop.QuitClosure(); |
| 101 scoped_ptr<TestObserver> observer(new TestObserver(fetcher.get(), | 102 scoped_ptr<TestObserver> observer(new TestObserver(fetcher.get(), |
| 102 run_loop.QuitClosure())); | 103 run_loop.QuitClosure())); |
| 103 fetcher->Start(url, transition); | 104 fetcher->Start(url, transition); |
| 104 run_loop.Run(); | 105 run_loop.Run(); |
| 105 | 106 |
| 106 EXPECT_EQ(expected_non_web_platform, non_web_platform_); | 107 EXPECT_EQ(expected_non_web_platform, non_web_platform_); |
| 107 EXPECT_EQ(expected_to_show, observer->will_show()); | 108 EXPECT_EQ(expected_to_show, observer->will_show()); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 RunBannerTest("/banners/prompt_in_handler_test_page.html", | 337 RunBannerTest("/banners/prompt_in_handler_test_page.html", |
| 337 ui::PAGE_TRANSITION_TYPED, 1, true); | 338 ui::PAGE_TRANSITION_TYPED, 1, true); |
| 338 } | 339 } |
| 339 | 340 |
| 340 IN_PROC_BROWSER_TEST_F(AppBannerDataFetcherBrowserTest, WebAppBannerInIFrame) { | 341 IN_PROC_BROWSER_TEST_F(AppBannerDataFetcherBrowserTest, WebAppBannerInIFrame) { |
| 341 RunBannerTest("/banners/iframe_test_page.html", ui::PAGE_TRANSITION_TYPED, 1, | 342 RunBannerTest("/banners/iframe_test_page.html", ui::PAGE_TRANSITION_TYPED, 1, |
| 342 false); | 343 false); |
| 343 } | 344 } |
| 344 | 345 |
| 345 } // namespace banners | 346 } // namespace banners |
| OLD | NEW |