Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: chrome/browser/ui/webui/theme_source_unittest.cc

Issue 2381093002: Move GetNewTabCSS() caching off the startup path. (Closed)
Patch Set: Fix test. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/theme_source.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h"
10 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/webui/theme_source.h" 12 #include "chrome/browser/ui/webui/theme_source.h"
12 #include "chrome/common/url_constants.h" 13 #include "chrome/common/url_constants.h"
13 #include "chrome/grit/theme_resources.h" 14 #include "chrome/grit/theme_resources.h"
14 #include "chrome/test/base/testing_profile.h" 15 #include "chrome/test/base/testing_profile.h"
15 #include "content/public/test/test_browser_thread.h" 16 #include "content/public/test/test_browser_thread.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using content::BrowserThread; 19 using content::BrowserThread;
19 20
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 TEST_F(WebUISourcesTest, ThemeSourceCSS) { 81 TEST_F(WebUISourcesTest, ThemeSourceCSS) {
81 content::TestBrowserThread io_thread(BrowserThread::IO, 82 content::TestBrowserThread io_thread(BrowserThread::IO,
82 base::MessageLoop::current()); 83 base::MessageLoop::current());
83 // Generating the test data for the NTP CSS would just involve copying the 84 // Generating the test data for the NTP CSS would just involve copying the
84 // method, or being super brittle and hard-coding the result (requiring 85 // method, or being super brittle and hard-coding the result (requiring
85 // an update to the unittest every time the CSS template changes), so we 86 // an update to the unittest every time the CSS template changes), so we
86 // just check for a successful request and data that is non-null. 87 // just check for a successful request and data that is non-null.
87 size_t empty_size = 0; 88 size_t empty_size = 0;
88 89
89 StartDataRequest("css/new_tab_theme.css"); 90 StartDataRequest("css/new_tab_theme.css");
91 base::RunLoop().RunUntilIdle();
90 EXPECT_NE(result_data_size_, empty_size); 92 EXPECT_NE(result_data_size_, empty_size);
91 93
92 StartDataRequest("css/new_tab_theme.css?pie"); 94 StartDataRequest("css/new_tab_theme.css?pie");
95 base::RunLoop().RunUntilIdle();
93 EXPECT_NE(result_data_size_, empty_size); 96 EXPECT_NE(result_data_size_, empty_size);
94 97
95 #if !DCHECK_IS_ON() 98 #if !DCHECK_IS_ON()
96 // Check that we send NULL back when we can't find what we're looking for. 99 // Check that we send NULL back when we can't find what we're looking for.
97 StartDataRequest("css/WRONGURL"); 100 StartDataRequest("css/WRONGURL");
98 EXPECT_EQ(result_data_size_, empty_size); 101 EXPECT_EQ(result_data_size_, empty_size);
99 #endif 102 #endif
100 } 103 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/theme_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698