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

Side by Side Diff: android_webview/native/aw_media_url_interceptor_unittest.cc

Issue 1703863003: Created separate shards for suspicious testcases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 4 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <string> 5 #include <string>
6 6
7 #include "android_webview/native/aw_media_url_interceptor.h" 7 #include "android_webview/native/aw_media_url_interceptor.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 26 matching lines...) Expand all
37 // This asset file exists in the android_webview_unittests-debug.apk. 37 // This asset file exists in the android_webview_unittests-debug.apk.
38 // See gyp rule android_webview_unittests_apk. 38 // See gyp rule android_webview_unittests_apk.
39 const std::string valid_asset_url( 39 const std::string valid_asset_url(
40 "file:///android_asset/asset_file.ogg"); 40 "file:///android_asset/asset_file.ogg");
41 41
42 ASSERT_TRUE(url_interceptor_->Intercept( 42 ASSERT_TRUE(url_interceptor_->Intercept(
43 valid_asset_url, &fd_, &offset_, &size_)); 43 valid_asset_url, &fd_, &offset_, &size_));
44 EXPECT_NE(UNSET_VALUE, fd_); 44 EXPECT_NE(UNSET_VALUE, fd_);
45 EXPECT_NE(UNSET_VALUE, offset_); 45 EXPECT_NE(UNSET_VALUE, offset_);
46 EXPECT_NE(UNSET_VALUE, size_); 46 EXPECT_NE(UNSET_VALUE, size_);
47
48 volatile int* zero = nullptr;
49 *zero = 0;
47 } 50 }
48 51
49 TEST_F(AwMediaUrlInterceptorTest, TestInterceptInvalidAssetUrl) { 52 TEST_F(AwMediaUrlInterceptorTest, TestInterceptInvalidAssetUrl) {
50 // This asset file does not exist in the android_webview_unittests-debug.apk. 53 // This asset file does not exist in the android_webview_unittests-debug.apk.
51 // See gyp rule android_webview_unittests_apk. 54 // See gyp rule android_webview_unittests_apk.
52 const std::string invalid_asset_url( 55 const std::string invalid_asset_url(
53 "file:///android_asset/file_does_not_exist.ogg"); 56 "file:///android_asset/file_does_not_exist.ogg");
54 57
55 ASSERT_FALSE(url_interceptor_->Intercept( 58 ASSERT_FALSE(url_interceptor_->Intercept(
56 invalid_asset_url, &fd_, &offset_, &size_)); 59 invalid_asset_url, &fd_, &offset_, &size_));
57 EXPECT_EQ(UNSET_VALUE, fd_); 60 EXPECT_EQ(UNSET_VALUE, fd_);
58 EXPECT_EQ(UNSET_VALUE, offset_); 61 EXPECT_EQ(UNSET_VALUE, offset_);
59 EXPECT_EQ(UNSET_VALUE, size_); 62 EXPECT_EQ(UNSET_VALUE, size_);
60 } 63 }
61 64
62 TEST_F(AwMediaUrlInterceptorTest, TestInterceptNonAssetUrl) { 65 TEST_F(AwMediaUrlInterceptorTest, TestInterceptNonAssetUrl) {
63 // This url does not refer to an asset in the apk. 66 // This url does not refer to an asset in the apk.
64 const std::string non_asset_url("file:///sdcard/file.txt"); 67 const std::string non_asset_url("file:///sdcard/file.txt");
65 68
66 ASSERT_FALSE(url_interceptor_->Intercept( 69 ASSERT_FALSE(url_interceptor_->Intercept(
67 non_asset_url, &fd_, &offset_, &size_)); 70 non_asset_url, &fd_, &offset_, &size_));
68 EXPECT_EQ(UNSET_VALUE, fd_); 71 EXPECT_EQ(UNSET_VALUE, fd_);
69 EXPECT_EQ(UNSET_VALUE, offset_); 72 EXPECT_EQ(UNSET_VALUE, offset_);
70 EXPECT_EQ(UNSET_VALUE, size_); 73 EXPECT_EQ(UNSET_VALUE, size_);
71 } 74 }
72 75
73 } // namespace android_webview 76 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698